Skip to content

Server islands doesn't work with Astro.self #1139

@vixalien

Description

@vixalien

Astro Info

Astro                    v5.14.5
Vite                     v6.4.0
Node                     v25.0.0
System                   Linux (x64)
Package Manager          pnpm
Output                   server
Adapter                  @deno/astro-adapter (v0.3.2)
Integrations             none

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

No response

Describe the Bug

I have code like this, which should load the batch component itself recursively when loading

---
interface Props {
  site_id: number;
  next_cursor?: string;
  count?: number;
}

import { getProfileMedia } from "../api";
import MediaLink from "./media-link.astro";

const { site_id, next_cursor: cursor, count = 1 } = Astro.props;

const { media, next_cursor } = await getProfileMedia(site_id, {
  cursor,
});
---

<>
  {media.map((item) => <MediaLink image={item.image} />)}
  {
    next_cursor && (
      <Astro.self
        site_id={site_id}
        next_cursor={next_cursor}
        count={count + 1}
        server:defer
      />
    )
  }
</>

Instead I get this error

Error: Could not find server component path
    at ServerIslandComponent.getComponentPath (/home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/runtime/server/render/server-islands.js:82:13)
    at ServerIslandComponent.getIslandContent (/home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/runtime/server/render/server-islands.js:108:32)
    at ServerIslandComponent.init (/home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/runtime/server/render/server-islands.js:52:32)
    at bufferHeadContent (file:///home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/runtime/server/render/astro/render.js:126:37)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    at async renderToAsyncIterable (file:///home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/runtime/server/render/astro/render.js:143:5)
    at async renderPage (file:///home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/runtime/server/render/page.js:36:24)
    at async lastNext (file:///home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/core/render-context.js:201:25)
    at async callMiddleware (file:///home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/core/middleware/callMiddleware.js:11:10)
    at async RenderContext.render (file:///home/alien/sites/memories/node_modules/.pnpm/astro@5.14.5_@types+node@24.8.1_jiti@2.6.1_lightningcss@1.30.1_rollup@4.52.4_typescript@5.9.3/node_modules/astro/dist/core/render-context.js:235:22)

Removing the server:defer works without issue

What's the expected result?

I would expect it to work

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-wl4aagvi?file=src%2Fcomponents%2Fbatch.astro

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions