Skip to content

[v6 - Cloudflare]: Server Island this.result.serverIslandNameMap.get is not a function regression in dev server #16045

@CaiJimmy

Description

@CaiJimmy

Astro Info

Astro                    v6.0.8
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

After starting the dev server, if the first page we visit does not contain the server island, an error will be thrown when we navigate to a page with a server island.

TypeError: this.result.serverIslandNameMap.get is not a function
    at ServerIslandComponent.getIslandContent (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/runtime/server/render/server-islands.js:110:55)
    at ServerIslandComponent.init (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/runtime/server/render/server-islands.js:52:32)
    at bufferHeadContent (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/runtime/server/render/astro/render.js:131:37)
    at renderToAsyncIterable (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/runtime/server/render/astro/render.js:148:11)
    at async renderPage (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/runtime/server/render/page.js:68:24)
    at async lastNext (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/core/render-context.js:259:25)
    at async callMiddleware (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/core/middleware/callMiddleware.js:11:10)
    at async RenderContext.render (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/core/render-context.js:293:73)
    at async AstroServerApp.render (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/core/app/base.js:348:20)
    at async run (/Users/jimmy/Documents/astro-v6-prerender/node_modules/.pnpm/astro@6.0.8_rollup@4.60.0/node_modules/astro/dist/vite-plugin-app/app.js:138:26)

However, if the first page we load contains the server island, there will be no error even if we navigate to a page without the server island and then go back.

In the reproducible example, try first go to localhost:4321, then click on the link that takes to page with server island, and error should appear.

However, if you shut down the server, and restart, then reload the page with server island, no error will appear.

Probably related: #15886

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)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