Replies: 1 comment 1 reply
-
You need to pass
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Environment
I'm trying to use getServerSession method in my nextjs app since most users who had the same issue when trying to get profile data returned by session suggested me to go for getServerSession instead of just "getSession", so i just wanted to give it a go hoping it would work fine in this case, but now getting such weird error..
the error only pops out after importing getServerSession, i have to use that, otherwise, removing it and going only for getSession to render session on the client side will return null data, so i wont be able to render user profile data returned by session, checked many times similar questions as well but no luck, cant tell enough how crucial it is for me, any help is highly appreciated.
@balazsorban44
error:
here is my Top component where i want to show user data:
Reproduction URL
https://github.com/Abdulberk/lunarshop
Describe the issue
getSession returns null data when using in getServerSideProps, so i switched to getServerSession instead and did the same as in the old one, with the thought of rendering session on the server side will just fix the issue, but now getting such weird error that i declared above
How to reproduce
just importing the getServerSession instead of just getSession will error out in the console, saying:
error - ./node_modules/@mapbox/node-pre-gyp/lib/clean.js:8:0
Module not found: Can't resolve 'fs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/ sync ^./.*$
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/bcrypt/bcrypt.js
./pages/api/auth/[...nextauth].js
./components/header/Top.js
./components/header/index.js
./pages/_app.js
Expected behavior
This should work fine, but no luck !
Beta Was this translation helpful? Give feedback.
All reactions