You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.
Currently our Next.js app uses server side rendering on almost all pages. It does a lot of await getSession(context) calls to verify the user is signed in before fetching data and showing them the page. Additionally in a lot of our API routes we make the same call to get the session to verify the user has access to whatever resource they're calling for.
The implementation for that method currently uses fetch and therefore http under the hood. Because we're running the app serverless on Vercel's platform this is extremely slow and makes the entire app feel sluggish.
The library is aiming to support a getServerSession method in v4 (which we're already on the beta version of) which should allow us to follow the recommended practice of not making fetch calls from a server side route.
Note: You should not use fetch() to call an API route in getServerSideProps. Instead, directly import the logic used inside your API route. You may need to slightly refactor your code for this approach.
Currently our Next.js app uses server side rendering on almost all pages. It does a lot of
await getSession(context)
calls to verify the user is signed in before fetching data and showing them the page. Additionally in a lot of our API routes we make the same call to get the session to verify the user has access to whatever resource they're calling for.The implementation for that method currently uses fetch and therefore http under the hood. Because we're running the app serverless on Vercel's platform this is extremely slow and makes the entire app feel sluggish.
The library is aiming to support a
getServerSession
method in v4 (which we're already on the beta version of) which should allow us to follow the recommended practice of not making fetch calls from a server side route.Below is a quote from the next documentation about this
Reference comment about this new method coming down the pipeline:
nextauthjs/next-auth#1535 (comment)
The text was updated successfully, but these errors were encountered: