withastro / astro · Issue No. 16931
Astro v6.4.2
Node v22.21.0
System Linux (x64)
Package manager pnpm
Output static
Adapter @astrojs/cloudflare
Integrations none (fresh project)
When using @astrojs/cloudflare adapter with static output (output: 'static'), the default image service generates runtime /_image?href=... URLs instead of static optimized image files. This causes all images to return 404 when deployed to Cloudflare Workers since there's no runtime handler for the /_image endpoint in static mode.
The issue occurs specifically when:
adapter: cloudflare() (default settings, no imageService specified)<Image /> component from astro:assetsoutput: 'static'Expected behavior: Static .webp files should be generated at build time and referenced directly in HTML.
Actual behavior: HTML contains /_image?href=%2F_astro%2F...&w=...&h=...&f=webp URLs that return 404.
With adapter: cloudflare({ imageService: 'compile' }), images work correctly:
.webp files in dist/client/_astro/src="/_astro/blog-placeholder-1.xxxxx.webp"The default behavior (adapter: cloudflare()) should either:
imageService: 'compile' is required for static deploymenthttps://stackblitz.com/github/withastro/astro/tree/main/examples/blog?file=astro.config.mjs
Steps to reproduce locally:
# Create new project with blog template
pnpm create cloudflare@latest --framework=astro
# Select "Blog" template, deploy to "Workers with Assets"
# Add Cloudflare adapter (if not already added)
pnpx astro add cloudflare
# Build (static output is default for blog template)
pnpm run build
# Deploy
pnpx wrangler deploy
# Check deployed site - all images 404
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.