Open bboyz269 opened 1 year ago
I see the same issue in v5 as well. I am using auth
as middleware in a nextjs app. Post successful login from the auth provider's login page, it redirects to home page with too many Set-Cookie
headers in the response:
Any resolution to this issue or am I doing something wrong.
Environment
Reproduction URL
-
Describe the issue
I have an API route that invokes
getServerSession
more than once. It's response headerset-cookie
was bloated withnext-auth.session_token
to the point HPE_HEADER_OVERFLOW was throw in proxy server.How to reproduce
-
Expected behavior
Consider that method name is "getServerSession", multiple calls should still generate and set to header only once (would be better if we can detect and re-use previous call result)
Code in question
https://github.com/nextauthjs/next-auth/blob/b96f01319c751c7d62433c24fdb9f3f8f1e572c1/packages/next-auth/src/next/index.ts#L210-L222