You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from 4.18.0 to 4.18.1 I'm seeing a very strange issue where my app no longer renders. Instead, Next renders the HTML of my app in a <pre> tag, so it looks like this:
What I've determined so far:
4.18.0 doesn't have this bug
4.18.1 and 4.18.3 have this bug
The issue only happens when using unstable_getServerSession
The issue only happens when you have logged in and have a session defined
How to reproduce
Check out the Stackblitz link I created. The issue is somewhat reproducible there. The "server" page there has a unstable_getServerSession used in getServerSideProps.
To reproduce the bug:
Run that Stackblitz example
Go to the "Server" page in the UI
Click on "Sign in" and try to sign in to one of the providers (doesn't mattern if you complete this or not)
Press the browser Back button to go back to the app
BUG: The UI no longer renders. Instead you get a <pre> tag with all the code of your app
Expected behavior
Bug doesn't happen. Next Auth should render the app as normal.
The text was updated successfully, but these errors were encountered:
EvHaus
added
the
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
label
Dec 8, 2022
balazsorban44
added
bug
Something isn't working
and removed
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Dec 8, 2022
Thanks, I identified the issue. As a workaround, you can set res.removeHeader("Content-Type") in your getServerSideProps after the unstable_getServerSession call.
The reason this happens is because unstable_getServerSession internally overrides the Content-Type to application/json, while the page using getServerSideProps should always return text/html.
Environment
System:
OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
Memory: 25.39 GB / 31.32 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 17.8.0 - ~/.nvm/versions/node/v17.8.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.5.5 - ~/.nvm/versions/node/v17.8.0/bin/npm
npmPackages:
next: 13.0.6 => 13.0.6
next-auth: 4.18.1 => 4.18.1
react: 18.2.0 => 18.2.0
Reproduction URL
https://stackblitz.com/edit/github-61ga3k-prdgby?file=pages%2Fserver.tsx
Describe the issue
After upgrading from 4.18.0 to 4.18.1 I'm seeing a very strange issue where my app no longer renders. Instead, Next renders the HTML of my app in a
<pre>
tag, so it looks like this:What I've determined so far:
unstable_getServerSession
How to reproduce
Check out the Stackblitz link I created. The issue is somewhat reproducible there. The "server" page there has a
unstable_getServerSession
used ingetServerSideProps
.To reproduce the bug:
<pre>
tag with all the code of your appExpected behavior
Bug doesn't happen. Next Auth should render the app as normal.
The text was updated successfully, but these errors were encountered: