Next.js Discord

Discord Forum

Error: React Context is unavailable in Server Components

Unanswered
Lionhead posted this in #help-forum
Open in Discord
LionheadOP
Is there any way to actually know where it happened? Looking through whole codebase manually, didn't find any issues.

Call Stack
4

Hide 4 ignore-listed frame(s)
resolveErrorDev
node_modules\next\dist\compiled\react-server-dom-webpack\cjs\react-server-dom-webpack-client.browser.development.js (1865:1)
processFullStringRow
node_modules\next\dist\compiled\react-server-dom-webpack\cjs\react-server-dom-webpack-client.browser.development.js (2245:1)
processFullBinaryRow
node_modules\next\dist\compiled\react-server-dom-webpack\cjs\react-server-dom-webpack-client.browser.development.js (2233:1)
progress
node_modules\next\dist\compiled\react-server-dom-webpack\cjs\react-server-dom-webpack-client.browser.development.js (2479:1)

4 Replies

If you’re using turbopack try to disable it by removing the “—turbo” flag, sometimes it hides details for the error traces (I have no idea why). Maybe it helps in your case
LionheadOP
Not using turbopack, just webpack
Either way, found the issue with the help of AI reviewing code so its resolved now

Not sure what is the problem with displaying the stack trace though, im pretty sure in this particular issue, whatever is detecting it, it must have access to what file it is processing, even if its bundled, at least giving some info would help :crySparkle:

well, there is a digest number, maybe that can be reverse engineered, but who knows aaaaaaaaaaaa
@Roseate Spoonbill Out of curiosity, what caused the issue?
LionheadOP
Was using SessionProvider in layout file, and that uses react context