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

HierarchyRequestError #944

Closed
monolithed opened this issue Mar 16, 2024 · 1 comment
Closed

HierarchyRequestError #944

monolithed opened this issue Mar 16, 2024 · 1 comment
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@monolithed
Copy link

monolithed commented Mar 16, 2024

Description

  1. At first, I followed the tutorial exactly as written and encountered the following error:
Error: Failed to call `useTranslations` because the context from `NextIntlClientProvider` was not found.
  1. Then, I found an example of "proper implementation", but it resulted in the same error as above. Moreover, it confused me even more because I found an issue stating that we should avoid using unstable_setRequestLocale.

  2. I added NextIntlClientProvider however, when I call useMessages(), I get a 404 error.

In summary, no matter where I use useTranslations or useMessages, I always encounter an error. I'm confused.

Mandatory reproduction URL

https://github.com/test-examples/next-intl

@monolithed monolithed added bug Something isn't working unconfirmed Needs triage. labels Mar 16, 2024
@amannn
Copy link
Owner

amannn commented Mar 18, 2024

Static rendering should not be implemented via force-static (please see the corresponding docs). Furthermore, unstable_setRequestLocale should be called before you call hooks like useMessages or useTranslations (see the corresponding docs).

There's unfortunately a bit of config involved to get static rendering working correctly, but hopefully we can get rid of this in the future.

If case you don't need static rendering, you can also avoid this API.

@amannn amannn closed this as completed Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants