Skip to content

@astrojs/node fails to load on-demand dynamic routes after static dynamic routes #16834

@faessler

Description

@faessler

Astro Info

Astro                    v6.3.7
Vite                     v7.3.3
Node                     v22.22.2
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node (v10.1.1)
Integrations             none

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

No response

Describe the Bug

With @astrojs/node adapter the on-demand dynamic routes are not loaded when static dynamic routes are loaded first. This worked previously with astro@5 and @astrojs/node@9.

Steps to reproduce

  1. Open linked stackblitz
  2. run npm run build
  3. run npm run preview
  4. open /page-1 (static page => works)
  5. open /foobar (on demand page => doesn't work but should work)

Attention: dev mode it works fine, you need to do a build and preview that one.

Example:

Does not work:

pages/
  [a_prebuild].astro 
  [b_ssr].astro

Does work:

pages/
  [a_ssr].astro
  [b_prebuild].astro

Note: same behavior for catch-all [...foobar].astro routes.

What's the expected result?

Having routes defined like this would still render on-demand pages:

pages/
  [a_prebuild].astro 
  [b_ssr].astro

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-b7qkswdh?startScript=build,preview

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)pkg: astroRelated to the core `astro` package (scope)pkg: nodeRelated to Node adapter (scope)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions