{"record":{"id":"eee871ac2f6cc711","repo":"withastro/astro","slug":"workerd-does-not-run-on-stackblitz","errorCode":null,"errorMessage":"`workerd` does not run on Stackblitz.","messagePattern":"`workerd` does not run on Stackblitz\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/integrations/cloudflare/src/index.ts","lineNumber":163,"sourceCode":"\tlet _routes: IntegrationResolvedRoute[];\n\tlet cfPluginConfig: PluginConfig;\n\tlet hasUserBuildImageService = false;\n\tlet compileImageConfig: CompileImageConfig | null = null;\n\n\tconst { buildService, runtimeService, transformAtBuild } =\n\t\tnormalizeImageServiceConfig(imageService);\n\tconst needsImagesBinding = runtimeService === 'cloudflare-binding';\n\tconst hasBuildImageService = buildService === 'compile' || buildService === 'custom';\n\t// Opt-in: user explicitly requested build-time image transformation via the compound config.\n\t// The string shorthand `'cloudflare-binding'` keeps the historical runtime-only behavior.\n\tconst isBindingBuild = transformAtBuild && buildService === 'cloudflare-binding';\n\n\treturn {\n\t\tname: '@astrojs/cloudflare',\n\t\thooks: {\n\t\t\t'astro:config:setup': async ({ command, config, updateConfig, logger, addWatchFile }) => {\n\t\t\t\tif (!!process.versions.webcontainer) {\n\t\t\t\t\tthrow new Error('`workerd` does not run on Stackblitz.');\n\t\t\t\t}\n\n\t\t\t\tlet session = config.session;\n\t\t\t\tconst isCompile = buildService === 'compile';\n\n\t\t\t\tif (needsImagesBinding) {\n\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t`Enabling image processing with Cloudflare Images for production with the \"${imagesBindingName}\" Images binding.`,\n\t\t\t\t\t);\n\t\t\t\t} else if (hasBuildImageService) {\n\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t`Enabling compile-time image optimization. Images will be pre-optimized at build time.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (session !== false && !session?.driver) {\n\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t`Enabling sessions with Cloudflare KV with the \"${sessionKVBindingName}\" KV binding.`,","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/withastro/astro/blob/e294953aa8aadd98d5be92e60a03037b05dbdfd4/packages/integrations/cloudflare/src/index.ts#L145-L181","documentation":"The @astrojs/cloudflare adapter needs to run the workerd binary to emulate Cloudflare's runtime, and workered cannot execute inside StackBlitz's WebContainer (browser-based Node emulation). At astro:config:setup the adapter checks `process.versions.webcontainer` and aborts immediately with this message. It is an intentional environment guard, not a bug.","triggerScenarios":"Opening an Astro project configured with the @astrojs/cloudflare adapter inside stackblitz.com (or any WebContainer-based environment) and running `astro dev` or `astro build`.","commonSituations":"Clicking a Cloudflare template on StackBlitz instead of running locally; trying to demo or teach an Astro + Cloudflare app in a browser playground; moving a project into a WebContainer-based IDE.","solutions":["Open the same repository locally (`git clone` + `npm install`) or in a real VM environment such as GitHub Codespaces / Gitpod.","If you only need a UI preview in StackBlitz, temporarily remove the cloudflare adapter from astro.config.mjs and use static output.","Use Cloudflare's own browser-based Workers playground to test worker code instead of StackBlitz."],"exampleFix":"// before (astro.config.mjs)\nimport cloudflare from '@astrojs/cloudflare';\nexport default defineConfig({ output: 'server', adapter: cloudflare() });\n\n// after — for StackBlitz preview only\nexport default defineConfig({ output: 'static' });","handlingStrategy":"validation","validationCode":"// astro.config.mjs — choose adapter only when workerd can actually run\nconst inWebContainer = !!process.versions.webcontainer;\nexport default defineConfig({\n  adapter: inWebContainer ? undefined : cloudflare(),\n  output: inWebContainer ? 'static' : 'server',\n});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `process.versions.webcontainer` in config or package scripts before enabling the cloudflare adapter.","Default to local clones or Codespaces for Cloudflare-adapter projects.","Document the environment requirement in the repo README so playground users see it up front."],"tags":["cloudflare","adapter","stackblitz","webcontainer","environment-check"],"backgroundTag":"unsupported-runtime-environment","analyzedSha":"e294953aa8aadd98d5be92e60a03037b05dbdfd4","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}