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
I tested this in middleware and any invocation of response.cookies.set() on a NextResponse after saving the session with await session.save() will not set the new session as a cookie.
The text was updated successfully, but these errors were encountered:
I can confirm this issue. We are chaining middleware functions together.
Simplified examples:
functionsetCookieMiddleware(req,res,ctx){res.cookies.set('foo','bar',{httpOnly: false})returnres}asyncfunctionsaveSessionMiddleware(req,res,ctx){ctx.session.foo='bar'awaitctx.session.save()returnresponse}// DOES NOT WORK: session cookie is not set in response headers, only foo cookie is presentconstmiddlewares=[saveSessionMiddleware,setCookieMiddleware,]// DOES WORK: both session cookie and foo cookie Set Cookie header present in response headersconstmiddlewares=[setCookieMiddleware,saveSessionMiddleware,]
I tested this in middleware and any invocation of response.cookies.set() on a NextResponse after saving the session with await session.save() will not set the new session as a cookie.
The text was updated successfully, but these errors were encountered: