diff --git a/platform/packages/api/src/provisioning/sandbox-controller.ts b/platform/packages/api/src/provisioning/sandbox-controller.ts index 5005d2b33..010f17c90 100644 --- a/platform/packages/api/src/provisioning/sandbox-controller.ts +++ b/platform/packages/api/src/provisioning/sandbox-controller.ts @@ -33,7 +33,6 @@ type WorkerSettings = { namespace_id?: string; service?: string; entrypoint?: string; - props?: Record; }>; }; @@ -134,18 +133,12 @@ function assertConfiguration( throw new Error(`Sandbox controller binding ${name} differs from this deployment.`); } } + // Cloudflare does not return service binding `props` from `/settings`. The + // plain-text bindings checked above come from the same upload as the props. const control = settings.bindings.find( (binding) => binding.type === 'service' && binding.name === '__VOID_SANDBOX_CONTROL', ); - if ( - control?.service !== apiService || - control.entrypoint !== 'SandboxControl' || - !control.props || - control.props.projectId !== identity.projectId || - control.props.deploymentId !== identity.deploymentId || - control.props.userId !== identity.userId || - control.props.slug !== identity.slug - ) { + if (control?.service !== apiService || control.entrypoint !== 'SandboxControl') { throw new Error('Sandbox controller authority binding differs from this deployment.'); } namespaceId(settings); diff --git a/platform/packages/api/test/integration/helpers.ts b/platform/packages/api/test/integration/helpers.ts index bc502ae17..b632e223c 100644 --- a/platform/packages/api/test/integration/helpers.ts +++ b/platform/packages/api/test/integration/helpers.ts @@ -1620,8 +1620,18 @@ export function mockCfApi(overrides: Partial = {}): MockCfApiHandle if (method === 'GET' && url.endsWith('/settings')) { const name = parseScriptNameFromUrl(url); const script = name ? state.hostScripts.get(name) : undefined; + // Cloudflare accepts `props` on a service binding upload and applies + // them at runtime, but never echoes them from `/settings`. return script - ? cfSuccess({ bindings: script.bindings }) + ? cfSuccess({ + bindings: script.bindings.map((binding) => { + if (binding.type !== 'service') { + return binding; + } + const { props: _props, ...rest } = binding; + return { ...rest, environment: 'production' }; + }), + }) : Response.json( { success: false, errors: [{ code: 10007, message: 'script not found' }] }, { status: 404 },