Skip to content

i18n fallback rewrite generates empty pages with @astrojs/node adapter #16113

@JefCurtis

Description

@JefCurtis

Astro Info

Astro                    v6.1.1
Vite                     v7.3.1
Node                     v22.18.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/node (v10.0.4)
Integrations             none

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

N/A — build-time issue

Describe the Bug

When using i18n.fallback with fallbackType: 'rewrite' and @astrojs/node adapter in middleware mode, all locale fallback pages are generated with empty response bodies during astro build. The default locale pages render correctly, but every fallback locale variant produces (file not created, response body was empty) and no files are written to disk.

Config:

export default defineConfig({
    i18n: {
        locales: ['en', 'es', 'fr'],
        defaultLocale: 'en',
        fallback: { es: 'en', fr: 'en' },
        routing: {
            prefixDefaultLocale: false,
            fallbackType: 'rewrite',
        },
    },
    adapter: node({ mode: 'standalone' }), // also reproduces with 'middleware' mode
})

Build output:

 prerendering static routes
   ├─ /about/index.html (+4ms)
   ├─ /es/about/index.html (+1ms) (file not created, response body was empty)
   ├─ /fr/about/index.html (+0ms) (file not created, response body was empty)
   ├─ /index.html (+1ms)
   ├─ /es/index.html (+0ms) (file not created, response body was empty)
   ├─ /fr/index.html (+0ms) (file not created, response body was empty)

This affects all pages regardless of complexity — even a simple static page with just an <h1> produces empty fallback variants. Zero locale directories are created in the build output.

Removing the adapter (pure static output) makes fallback pages generate correctly. The bug only occurs when @astrojs/node adapter is present.

Pages have export const prerender = true set explicitly.

Note: This is related to #13964 / PR #14017 which fixed the runtime ForbiddenRewrite error for the same config combination. The runtime fix is present in v6.1.1, but the build-time generation of fallback pages produces empty bodies instead of the expected content.

What's the expected result?

Locale fallback pages should be generated with the same content as the default locale page, matching Astro 5.x behavior. For example, /es/about/index.html should contain the same HTML as /about/index.html.

Link to Minimal Reproducible Example

https://github.com/JefCurtis/astro-i18n-fallback-rewrite-repro

StackBlitz: https://stackblitz.com/github/JefCurtis/astro-i18n-fallback-rewrite-repro

Steps to reproduce:

  1. Clone the repo
  2. npm install
  3. npx astro build
  4. Observe that /es/ and /fr/ pages show (file not created, response body was empty)

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)

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