Problem with experimental localeDetector and Firebase with SSR enabled #3267
Unanswered
ilyamisyura
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I found an interesting bug when using experimental
localeDetector
on Firebase with SSR enabled.I have tested the same configuration deployed to Netlify, and netlify instance doesn't have this bug and everything works perfectly.
What I want
A 'no_prefix' strategy, locale must be controlled by the cookie, server-side rendering (SSR) enabled.
What I have
Dependencies:
i18n section from
nuxt.config.ts
:Some say that
i18n.config.ts
andlegacy: false
flag could solve the issue, but having it or not doesn't affect the problem. I have it, so it must be declared here:localeDetector.ts follows the suggested approach from the documentation and designed to work with cookies only:
Main problem
Every time I reload the page on the instance hosted on Firebase (hosting, functions)
and the response sets the cooke accordingly with Set-Cookie: i18n_locale=default_browser_locale/fallback_locale.
Again, important note: Netlify instance works stable in all cases.
No-SSR case
with
ssr: false
in nuxt.config.ts everything works correctly, as desired.Detailed Firebase behavior
A request from the browser that supports English while loading a website looks like this:
Here comes the problem: the response contains "Set-Cookie: i18n_locale=en":
Netlify behavior
While the request looks the same and contains
Cookie: i18n_locale=de
, the response doesn't haveSet-Cookie: i18n_locale=default_browser_locale/fallback_locale
Question to the community
Have you ever faced such an issue? Most probably the problem is on Firebase side, but still it's hard for me to understand what's in the core.
Would love to hear from anyone!
Beta Was this translation helpful? Give feedback.
All reactions