Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status 404 for existing pages #1975

Closed
1 task
dragomano opened this issue Jun 6, 2024 · 9 comments · Fixed by #1993
Closed
1 task

Status 404 for existing pages #1975

dragomano opened this issue Jun 6, 2024 · 9 comments · Fixed by #1993
Labels
🐛 bug Something isn't working

Comments

@dragomano
Copy link
Contributor

dragomano commented Jun 6, 2024

What version of starlight are you using?

0.24.1

What version of astro are you using?

4.10.1

What package manager are you using?

pnpm

What operating system are you using?

Windows

What browser are you using?

Firefox

Describe the Bug

Startlight 0.23.4:
sshot-10

Starlight 0.24.0/0.24.1:
sshot-17

In both cases, the pages exist and are displayed.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ztcekb

Participation

  • I am willing to submit a pull request for this issue.
@delucis
Copy link
Member

delucis commented Jun 8, 2024

Thanks for reporting this @dragomano — I think this is caused because we now use Astro’s i18n API under the hood and I guess that is reporting 404s for those routes even though the exist? Definitely a weird bug given pages render fine in dev and also build fine — it’s just the status code which is being set incorrectly.

I’m curious if anyone has seen this in other uses of Astro’s i18n features? 🤔

cc @ematipico

@delucis delucis added 🐛 bug Something isn't working labels Jun 8, 2024
@lorenzolewis
Copy link
Contributor

I'm curious if this is an issue with en being hard-coded in some places in Starlight? Based on the repro, the locale config looks like this:

{
  defaultLocale: 'root',
    locales: {
      root: {
        label: 'Русский',
        lang: 'ru',
      },
    },
}

Some error messages when running npm run dev:

npm run dev

> @example/[email protected] dev
> astro dev

10:08:52 AM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/utils/i18n.ts:
|- AstroUserError: Failed to get locale informations for the 'en' locale.

10:08:52 AM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/integrations/shared/localeToLang.ts: failed to import "/node_modules/@astrojs/starlight/utils/i18n.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.

10:08:52 AM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/integrations/expressive-code/translations.ts: failed to import "/node_modules/@astrojs/starlight/integrations/shared/localeToLang.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.

10:08:52 AM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/integrations/expressive-code/index.ts: failed to import "/node_modules/@astrojs/starlight/integrations/expressive-code/translations.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.

10:08:52 AM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/index.ts: failed to import "/node_modules/@astrojs/starlight/integrations/expressive-code/index.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.

10:08:52 AM [vite] Error when evaluating SSR module /home/projects/github-ztcekb/astro.config.mjs: failed to import "/node_modules/@astrojs/starlight/index.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.

[astro] Unable to load your Astro config

[AstroUserError] Failed to get locale informations for the 'en' locale.
  Hint:
    Make sure to provide a valid BCP-47 tags (e.g. en, ar, or zh-CN).

@HiDeoo
Copy link
Member

HiDeoo commented Jun 9, 2024

Some error messages when running npm run dev:

The error you're seeing is probably related to #1986 and I'm assuming you may have opened the repro using Safari.

I'm currently working on a fix for that one right now.

@lorenzolewis
Copy link
Contributor

Ah yup, it was Safari. Once again my testing in the worst browser for JS gets me again 😅

@ematipico
Copy link
Member

ematipico commented Jun 10, 2024

How do I get to see the error from the reproduction? It just fails (using firefox) cc @dragomano

@lorenzolewis
Copy link
Contributor

If you’re troubleshooting you should also update to starlight 0.24.1 as it fixed an issue related to this. But it may have not resolved the full issue.

@dragomano
Copy link
Contributor Author

I've updated dependencies. It's still a problem.

@ematipico
Copy link
Member

Changing root.lang to en fixes the issue... so maybe there are places where starlight is pulling en instead of the configured root lang

@delucis
Copy link
Member

delucis commented Jun 12, 2024

Fixed in Starlight v0.24.2 — thanks again for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants