Next-auth integration (app router) #5704
Unanswered
danieljmann96
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to create a context/middleware procedure where the middleware checks the next-auth session before proceeding. In DEV this all works as expected, however when building for production:
Error:
headers
was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-contextI have narrowed this down to the way I'm calling getServerSession within createContext (as if I comment this out it builds fine). Is there an alternative way to get around this? Why does it work in dev and not production?
Beta Was this translation helpful? Give feedback.
All reactions