next-auth login() redirection doesn't work
adamsh25 opened this issue · comments
Use case:
I used the repo below and added next-auth using Cognito provider:
https://github.com/plevavas/monorepo
https://next-auth.js.org/getting-started/example
https://next-auth.js.org/providers/cognito
The redirection to Cognito login does work locally when debugging in vs code
Issue:
The redirection to Cognito login does NOT work when deployed with tosladg/nextjs-lambda@v3.20.3
Hey @adamsh25 !
Any chance you might have a logs on your hand? Also, if you say that redirection does not work - do you get some Internal Error? Does not not function at all? Do you get stuck on API route?
Hey @sladg I will need to redeploy this test, I will be able to do so over the weekend.
Thank you!
I did replicate the behaviour, tested on Cognito and latest Next-auth. It indeed does not redirect properly.
From what I was able to gather around Github, it seems like cookies/headers are not passed properly through Cloudfront, I tried out tweaking Origin Request and Cache policies, but no luck. I wasn't able to find what headers/cookies are used/necessary, it will probably require digging into source code of the next-auth.
Let me know if you find some more info!
Might be related to: nextauthjs/next-auth#5561