Skip to content

[i18n] Dynamic routes return 500 "TypeError: Missing parameter" when using domain-based routing (domains-prefix-other-locales) in SSR #16854

@akselinurmio

Description

@akselinurmio

Astro Info

Astro                    v6.3.7
Vite                     v7.3.3
Node                     v24.14.1
System                   Linux (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/vercel (v10.0.7)
Integrations             none

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

No response

Describe the Bug

When using i18n.domains to map a non-default locale to a separate domain (strategy domains-prefix-other-locales), visiting a dynamic route on the non-default locale's domain returns HTTP 500 with TypeError: Missing parameter: <paramName>. Static routes on the same domain work fine.

The bug seems to be in RenderContext in Astro's SSR core. computePathnameFromDomain correctly detects the locale from the domain and prepends the locale prefix to the URL path (e.g. /boats/1/sunset-cruiser/en/boats/1/sunset-cruiser) to match the route. However, this.pathname on RenderContext is set from the raw request URL and is never updated to the locale-prefixed form. When getProps is later called, it calls getParams(route, this.pathname) — the route pattern requires /en/boats/… but this.pathname is /boats/…, so the regex doesn't match, params come back as {}, and stringifyParams({}, route) throws TypeError: Missing parameter: <paramName>.

The default locale domain is unaffected because it is not in domainLookupTable, so computePathnameFromDomain returns undefined and the normal routing path is taken.

What's the expected result?

Visiting a dynamic route on the non-default locale's domain (e.g. https://en.example.com/boats/1/sunset-cruiser) should render the page and expose the correct Astro.params values, the same as the equivalent page on the default locale domain.

Link to Minimal Reproducible Example

https://github.com/akselinurmio/astro-i18n-domain-bug

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