{"record":{"id":"6d64110cec322d27","repo":"withastro/astro","slug":"the-current-configuration-does-not-support-image-o","errorCode":null,"errorMessage":"The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'passthrough' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice","messagePattern":"The current configuration does not support image optimization\\. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'passthrough' option\\. See https://docs\\.astro\\.build/en/reference/configuration-reference/#imageservice","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/integrations/cloudflare/src/utils/image-config.ts","lineNumber":151,"sourceCode":"\t\tcase 'custom':\n\t\t\t// Sharp's native binding cannot load inside workerd, in dev or in production.\n\t\t\t// This also catches `imageService: 'custom'` without a configured `image.service`,\n\t\t\t// which silently inherits Astro's default Sharp service.\n\t\t\tif (command === 'dev' && config.service.entrypoint === SHARP_IMAGE_SERVICE) {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t`The Sharp image service cannot run inside the workerd runtime, so '/_image' requests will fail in dev and production. Configure a workerd-compatible 'image.service', or set 'imageService' to 'compile' for build-time optimization. See https://docs.astro.build/en/guides/integrations-guide/cloudflare/#imageservice`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...config,\n\t\t\t\t// Astro's default dev endpoint imports `vite` and `node:fs`, which are\n\t\t\t\t// unavailable in workerd. Use the generic (fetch-based) endpoint instead.\n\t\t\t\t...(command === 'dev' && !config.endpoint?.entrypoint && { endpoint: GENERIC_ENDPOINT }),\n\t\t\t};\n\n\t\tdefault:\n\t\t\tif (config.service.entrypoint === 'astro/assets/services/sharp') {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t`The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'passthrough' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice`,\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\t...config,\n\t\t\t\t\tservice: passthroughImageService(),\n\t\t\t\t\t...(command === 'dev' && !config.endpoint?.entrypoint && { endpoint: GENERIC_ENDPOINT }),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...config,\n\t\t\t\t...(command === 'dev' && !config.endpoint?.entrypoint && { endpoint: GENERIC_ENDPOINT }),\n\t\t\t};\n\t}\n}\n","sourceCodeStart":133,"sourceCodeEnd":166,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/integrations/cloudflare/src/utils/image-config.ts#L133-L166","documentation":"Fallback branch of the Cloudflare adapter's image-config hook: when the resolved image service entrypoint is exactly 'astro/assets/services/sharp' (Astro's core default) and no earlier case matched, the adapter warns that this environment cannot optimize images, swaps the service to passthroughImageService(), and continues — the build succeeds but ships original, unoptimized images.","triggerScenarios":"Building (or resolving config) with @astrojs/cloudflare while the image service still resolves to Sharp — i.e. imageService neither 'compile' nor an explicit workerd-compatible custom service — so the adapter silently downgrades optimization to passthrough.","commonSituations":"Newly deployed Cloudflare projects where page weight suddenly grows because images stopped being optimized; teams unaware the default Sharp service is incompatible with workerd and that the adapter substituted a no-op.","solutions":["Make the strategy explicit: adapter option imageService: 'compile' to optimize at build time","Or deliberately use 'passthrough' and optimize at the CDN/edge layer instead","Or implement a workerd-compatible custom image.service referenced from config","After changing config, verify built output actually contains optimized assets"],"exampleFix":"// before\nintegrations: [cloudflare()] // adapter force-switches to passthrough; images unoptimized\n\n// after\nintegrations: [cloudflare({ imageService: 'compile' })] // optimized at build time","handlingStrategy":"validation","validationCode":"// astro.config.mjs — explicit choice prevents the silent passthrough switch\nimport cloudflare from '@astrojs/cloudflare';\nexport default defineConfig({\n  integrations: [cloudflare({ imageService: 'compile' })], // 'passthrough' if CDN optimizes\n});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make imageService an explicit, reviewed decision in every Cloudflare project","Assert image asset sizes in CI to detect silent passthrough downgrades","Re-verify image configuration after adapter upgrades"],"tags":["cloudflare","images","passthrough","sharp","optimization"],"backgroundTag":"image-optimization-unavailable","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}