[next-auth]: `useSession` must be wrapped in a <SessionProvider /> pages folder move to inside src folder-

See original GitHub issue

Description 🐜

Moving pages folder to src. Getting error [next-auth]: useSession must be wrapped in a <SessionProvider />. Working fine when pages folder on root dir.

Screenshot 2021-10-29 at 1 43 21 PM

Is this a bug in your own project?

No

How to reproduce β˜•οΈ

Move pages folder to inside src folder mkdir src move pages to src dir

Screenshots / Logs πŸ“½

PFA - Error Screenshot 2021-10-29 at 1 41 07 PM

Environment πŸ–₯

System: OS: macOS 11.3.1 CPU: (8) arm64 Apple M1 Memory: 128.27 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.8.0 - /opt/homebrew/bin/node Yarn: 1.22.11 - /opt/homebrew/bin/yarn npm: 7.21.0 - /opt/homebrew/bin/npm Browsers: Chrome: 95.0.4638.54 Edge: 92.0.902.67 Safari: 14.1 npmPackages: next: 12.0.1 => 12.0.1 next-auth: ^4.0.0-beta.5 => 4.0.0-beta.5 react: 17.0.2 => 17.0.2

Contributing πŸ™ŒπŸ½

No, I am afraid I cannot help regarding this

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

24reactions
gabrielmlinassicommented, Feb 18, 2022

In my case, the problem was related to cache. I deleted the .next folder and worked.

4reactions
balazsorban44commented, Oct 30, 2021

Then that’s the issue. Your SessionProvider has to come before LayoutWrapper.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - [next-auth]: `useSession` must be wrapped in a ...
This is my code with the next-auth and this throwing this error "[next-auth]: useSession must be wrapped in a SessionProvider".
Read more >
usesession must be wrapped in a sessionprovider - YouTube
usesession must be wrapped in a sessionprovider | next auth error in nextjs app. Watch later. Share. Copy link.
Read more >
Upgrade Guide (v4) - NextAuth.js
Version 4 makes using the SessionProvider mandatory. This means that you will have to wrap any part of your application using useSession inΒ ......
Read more >
How to use NextAuth.js for client-side authentication in Next.js
Learn how to use NextAuth.js for client-side authentication in Next.js. Users can login with a GitHub, Google, or Facebook account.
Read more >
next auth client fetch error | The AI Search Engine You Control
How to solve client fetch error for next-auth authentication ... Next.js! exists on the page [next-auth]: `useSession` must be wrapped in a <SessionProvider...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found