{"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":162,"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":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/integrations/cloudflare/src/index.ts#L144-L180","documentation":"Thrown by `@astrojs/cloudflare` during `astro:config:setup` when the runtime is detected as a Stackblitz WebContainer (`process.versions.webcontainer` is set). Cloudflare's local runtime `workerd` is incompatible with WebContainer's emulated environment, so the integration refuses to initialize rather than failing opaquely later.","triggerScenarios":"Running `astro dev` or `astro build` with `@astrojs/cloudflare` adapter inside a Stackblitz or Codeflow project. The check `!!process.versions.webcontainer` is true, triggering the throw before any adapter setup.","commonSituations":"Opening an Astro+Cloudflare project on stackblitz.com. Using GitHub Codespaces with a WebContainer-backed preview. The adapter is installed but the user is prototyping on Stackblitz.","solutions":["Develop locally (native Node) instead of Stackblitz when using the Cloudflare adapter.","Temporarily remove or disable `@astrojs/cloudflare` from adapters while on Stackblitz, then re-enable locally.","Use the Node adapter (`@astrojs/node`) for Stackblitz-based development."],"exampleFix":"// before — astro.config.mjs on Stackblitz\nimport cloudflare from '@astrojs/cloudflare';\nexport default defineConfig({ adapter: cloudflare() });\n\n// after — swap to node adapter for Stackblitz\nimport node from '@astrojs/node';\nexport default defineConfig({ adapter: node({ mode: 'standalone' }) });","handlingStrategy":"validation","validationCode":"// Detect Stackblitz/WebContainer before configuring the adapter.\nif (process.versions.webcontainer) {\n  console.warn('Cloudflare adapter unsupported on Stackblitz; use @astrojs/node.');\n}","typeGuard":"function isWebContainer(): boolean {\n  return Boolean((process.versions as any).webcontainer);\n}","tryCatchPattern":null,"preventionTips":["Avoid installing @astrojs/cloudflare in WebContainer-based environments.","Branch your astro.config by environment when sharing a repo across local and Stackblitz.","Document the Stackblitz limitation in your project README."],"tags":["cloudflare","stackblitz","adapter","environment"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}