Skip to content

[next-auth]: useSession must be wrapped in a <SessionProvider /> pages folder move to inside src folder next13 app dir #7735

@liamtran96

Description

@liamtran96

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
Screenshot 2023-06-05 at 7 57 14 AM
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
Screenshot 2023-06-05 at 8 01 09 AM

Provider
Screenshot 2023-06-05 at 8 01 35 AM

authOptions
Screenshot 2023-06-05 at 8 03 38 AM

Screenshot 2023-06-05 at 8 04 04 AM

I think there are something wrong with the layout.tsx file
Screenshot 2023-06-05 at 8 04 25 AM

I use the useSession in my login page
Screenshot 2023-06-05 at 8 05 51 AM

Expected behavior

How can I fix the error, many thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    providerstriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions