Skip to content

Astro v6 + CloudFlare adapter + <Image> in dev mode throws error #15319

@n3dst4

Description

@n3dst4

Astro Info

Astro                    v6.0.0-beta.3
Vite                     v7.3.1
Node                     v24.13.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/cloudflare (v13.0.0-beta.1)
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

A newly created project using the current beta of Astro and the Cloudflare adapter, upgraded to current v6 beta releases, throws an error in the browser when there is an <Image> component on a page, in astro dev mode only (build + preview works correctly.)

Steps to reproduce

  1. Clone the reproduction repository below
  2. Run pnpm install
  3. Run pnpm run dev
  4. Open http://localhost:4321 in your browser

Actual result

Error:

The file does not exist at "[PATH TO PROJECT]/node_modules/.vite/deps_ssr/chunk-BB2NZPL6.js?v=c17d9a8e" which is in the optimize deps directory. The dependency might be incompatible with the dep optimizer. Try adding it to `optimizeDeps.exclude`.

    at CustomModuleRunner.cachedModule (workers/runner-worker.js:1196:20)
    at request (workers/runner-worker.js:1123:83)
    at null.<anonymous> (/home/ndc/projects/astro-cloudflare-image-repro/node_modules/.vite/deps_ssr/chunk-FCOL542Q.js:1:1)
    at Object.runInlinedModule (workers/runner-worker.js:1314:4)
    at CustomModuleRunner.directRequest (workers/runner-worker.js:1166:59)
    at CustomModuleRunner.cachedRequest (workers/runner-worker.js:1084:73)
    at null.<anonymous> (/home/ndc/projects/astro-cloudflare-image-repro/node_modules/.vite/deps_ssr/chunk-HKIE33OW.js:1:1)
    at Object.runInlinedModule (workers/runner-worker.js:1314:4)
    at CustomModuleRunner.directRequest (workers/runner-worker.js:1166:59)
    at CustomModuleRunner.cachedRequest (workers/runner-worker.js:1084:73)

What's the expected result?

You should see an image in the browser.

Additional notes

Building the project with

pnpm run build
pnpm run preview

Does NOT manifest the error (the page with the image is shown correctly.)

Apologies for the GitHub repro, as with #15194 I couldn't get workerd to run in stackblitz.

Link to Minimal Reproducible Example

https://github.com/n3dst4/astro-cloudflare-image-repro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)6-betaIssues affects the beta of Astro 6pkg: cloudflareRelated to the Cloudflare adapter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions