Skip to content

[v6 / Cloudflare] serverIslandMap?.get is not a function in pre-rendered page #15886

@CaiJimmy

Description

@CaiJimmy

Astro Info

Astro                    v6.0.4
Node                     v25.8.1
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/cloudflare
Integrations             none

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

All

Describe the Bug

A server island component (server:defer) inside a pre-rendered page does not work correctly.

In preview environment (pnpm build then pnpm preview), the following error is thrown:

17:15:49 [ERROR] TypeError: serverIslandMap?.get is not a function
    at page (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:9188:32)
    at async callComponentAsTemplateResultOrResponse (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:7116:25)
    at async renderToReadableStream (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:7064:26)
    at async renderPage (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:8320:14)
    at async lastNext (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:11522:25)
    at async callMiddleware (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:8412:10)
    at async RenderContext.render (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:11556:73)
    at async App.render (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:12451:20)
    at async Object.handle [as fetch] (file:///Users/jimmy/Documents/repro-cf-v6/dist/server/entry.mjs:12961:20)

I have added some console.log to see what is the value of serverIslandMap at that stage, and it has returned a string with value $$server-islands-map$$.

Image Image

In dev server this is working correctly when prerenderEnvironment is set to workerd. When set to node, a 400 is returned with server island request.

Might be related with #15767

What's the expected result?

No error should be thrown.

Link to Minimal Reproducible Example

https://github.com/CaiJimmy/astro-v6-prerender

Participation

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

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly impacts performance (priority)- P5: urgentFix build-breaking bugs affecting most users, should be released ASAP (priority)feat: server islandsRelated to Server Islands (scope)pkg: astroRelated to the core `astro` package (scope)pkg: 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