withastro / adapters

Home for Astro's core maintained adapters
69 stars 41 forks source link

@astro/cloudflare images using the `imageService: cloudflare` not being linked properly #161

Closed timsexperiments closed 9 months ago

timsexperiments commented 9 months ago

Astro Info

Astro                    v4.3.5
Node                     v21.6.1 // Doesn't matter because the issue with running in cloudflare
System                   macOS (arm64) // Irrelevant. Issue is on cloudflare
Package Manager          bun // Irrelevant. Cloudflare does not use bun.
Output                   hybrid
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/mdx
                         @astrojs/sitemap
                         @astrojs/tailwind
                         astro-icon

Describe the Bug

DISCLAIMER - I am not using a version of Node that Astro supports (using cloudflare runtime as this issue is with the cloudflare adapter)

When deploying and astro site to cloudflare with the following configuration, the images are not coming through properly

export default defineConfig({
  site: 'https://arumi.design',
  integrations: [mdx(), sitemap(), tailwind(), icon()],
  output: 'hybrid',
  adapter: cloudflare({ imageService: 'passthrough' }),
});

The images on the site are being generated with a link that results in a 404. My guess is this is supposed to be generated as a worker function that generates the image or (preferably since I'm in hybrid mode) generates the image once for each page when doing static generation.

Link to site deployment with broken images on cloudflare (not sure how long they keep these old deployment links working): https://f36fc3ed.www-arumi-design.pages.dev/

Link to repo at broken state: https://github.com/timsexperiments/www.arumi.design/tree/84b94b686460af930a81e5bfdca12d79179232c9

What's the expected result?

When generating the static pages, the images should be created through whatever the 'cloudflare' image service is, and links should be generated properly and put into the generated image tags from the astro:assets Image component.

Link to Minimal Reproducible Example

https://github.com/timsexperiments/www.arumi.design/tree/84b94b686460af930a81e5bfdca12d79179232c9

Participation

alexanderniebuhr commented 9 months ago

Thanks for reporting. I'm seeing your site works with imageService: ''passtrough"..

Do be able to use imageService: "cloudflare" you need to have image resizing enabled in your zone in Cloudflare, have you made sure that it is enabled?

image

alexanderniebuhr commented 9 months ago

This issue seems to be inactive, therefore I'm going to close this. If new activity is added, we will open it again.