[next-auth]: useSession must be wrapped in a <SessionProvider /> pages folder move to inside src folder next13 app dir #7747
Unanswered
liamtran96
asked this question in
Help
Replies: 3 comments 4 replies
-
I also encountered the same problem, my nextjs version is 13.4.4 |
Beta Was this translation helpful? Give feedback.
2 replies
-
I also met that kind of error Error: [next-auth]: |
Beta Was this translation helpful? Give feedback.
2 replies
-
Create a new file "SessionWrapper"
import it in layout.js file and wrap the body with it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Provider type
Credentials
Environment
System:
OS: macOS 13.3.1
CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Memory: 261.21 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.15.0 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 9.6.2 - /usr/local/bin/npm
Browsers:
Chrome: 114.0.5735.90
Firefox: 112.0.2
Safari: 16.4
Reproduction URL
local development
Describe the issue
I am using next 13.4.0 app dir with nextauth 4.22.1 for my authentication but I got the error [next-auth]: useSession must be wrapped in a pages folder move to inside src folder on my console

There was some suggestions here #3061 it works permanently, the error still there when i start my project when i use: yarn dev
How to reproduce
So this is my config with next auth Credentials

Provider

authOptions

I think there are something wrong with the layout.tsx file

I use the useSession in my login page

Expected behavior
How can I fix the error, many thanks!!
Beta Was this translation helpful? Give feedback.
All reactions