Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

next.js - Next-Auth getSession is returning null in my development environment

I'm using the following code in one of my pages:

export async function getServerSideProps(context) {
  const session = await getSession(context)
  return {
    props: { session }
  }
}

and the session is returning null. I get the following error:

[next-auth][error][client_fetch_error] [
  'http://localhost:3000/api/auth/session',
  FetchError: request to http://localhost:3000/api/auth/session failed, reason: read ECONNRESET

if I try to navigate to http://localhost:3000/api/auth/session in my browser I get the session object normally. Also, my co-worker has the same code in his machine and it is working fine for him.

The only difference that I know between my environment and his is that I'm using windows and he is using mac. Not really sure if this can be causing the problem here.

question from:https://stackoverflow.com/questions/65909732/next-auth-getsession-is-returning-null-in-my-development-environment

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...