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

Error: getRequestConfig is not supported in Client Components. #685

Closed
Robin-Ln opened this issue Dec 2, 2023 · 2 comments · Fixed by #687
Closed

Error: getRequestConfig is not supported in Client Components. #685

Robin-Ln opened this issue Dec 2, 2023 · 2 comments · Fixed by #687
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@Robin-Ln
Copy link

Robin-Ln commented Dec 2, 2023

Description

when i upgrade to 3.2.1 from 3.2.0 i get this error :

 ⨯ Error: `getRequestConfig` is not supported in Client Components.
    at <unknown> (webpack-internal:///(middleware)/./node_modules/.pnpm/next-intl@3.2.1_next@14.0.3_react@18.2.0/node_modules/next-intl/dist/development/server/react-client/index.js:13)
    at eval (webpack-internal:///(middleware)/./node_modules/.pnpm/next-intl@3.2.1_next@14.0.3_react@18.2.0/node_modules/next-intl/dist/development/server/react-client/index.js:13:15)
    at eval (webpack-internal:///(middleware)/./src/configs/i18n.ts:27:132)
    at (middleware)/./src/configs/i18n.ts (file:///Users/rlouarn/git/programme-tz-2023/.next/server/src/middleware.js:740:1)
    at __webpack_require__ (file:///Users/rlouarn/git/programme-tz-2023/.next/server/edge-runtime-webpack.js:37:33)
    at fn (file:///Users/rlouarn/git/programme-tz-2023/.next/server/edge-runtime-webpack.js:306:21)
    at eval (webpack-internal:///(middleware)/./src/middleware.ts:6:71)
    at (middleware)/./src/middleware.ts (file:///Users/rlouarn/git/programme-tz-2023/.next/server/src/middleware.js:751:1)

Mandatory reproduction URL (CodeSandbox or GitHub repository)

https://gitlab.com/robin.louarn/programme-tz-2023

Reproduction description

Steps to reproduce:

  1. upgrade to 3.2.1
  2. run pnpm app:dev
  3. See error: ⨯ Error: 'getRequestConfig' is not supported in Client Components.

Expected behaviour

Work like in version 3.2.0

@Robin-Ln Robin-Ln added bug Something isn't working unconfirmed Needs triage. labels Dec 2, 2023
@Rikard-Johansson97
Copy link

I get the same. next-intl@3.2.1 and next@14.0.3.

I downgraded to 3.2.0 and now it works again

@M-Nasser-M
Copy link

i got the same issue next-intl@3.2.1 and next@14.0.3
downgrading also works for me

amannn added a commit that referenced this issue Dec 4, 2023
…ient Component module graph (#687)

Fixes #685 

This is fixed for compatibility, since we've silently supported this
pattern previously. However, it's still not recommended to call
`getRequestConfig` in a Client Component module graph as the function
can't do anything useful there. Instead, you can extract shared config
like `locales` to a file like
[`src/navigation.ts`](https://next-intl-docs.vercel.app/docs/routing/navigation)
or any other module that is then imported into Client and Server
Components.
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
3 participants