Next.js 13.4.19 doesn't work with Next-Auth 4.23.1 in Docker
Answered
nyxz posted this in #help-forum
nyxzOP
I'm deploying the Next.js application in a container but when requested through the domain https://mywebsite.com it redirects me to the
I found this thread in Reddit https://www.reddit.com/r/nextjs/comments/15ryr0u/nextauth_redirect_to_docker_container_ip_instead/?rdt=46942 where people suggest I should downgrade to Next.js 13.4.12 and it would work.
Does anyone here know a different solution to that problem where I don't need to downgrade libraries?
<container IP address>/api/auth/signin?callbackUrl=%2F% instead https://mywebsite.com/api/auth/signin?callbackUrl=<callbackurl>.I found this thread in Reddit https://www.reddit.com/r/nextjs/comments/15ryr0u/nextauth_redirect_to_docker_container_ip_instead/?rdt=46942 where people suggest I should downgrade to Next.js 13.4.12 and it would work.
Does anyone here know a different solution to that problem where I don't need to downgrade libraries?
Answered by European sprat
Did you try
ENV HOSTNAME 0.0.0.0 and then rebuilding your image?8 Replies
European sprat
Did you try
ENV HOSTNAME 0.0.0.0 and then rebuilding your image?Answer
European sprat
because that should be the fix
Sloth bear
use next-auth experimental version will work
nyxzOP
@European sprat I tried that because I saw in the Reddit thread, but it didn't work for me. I might as well be missing something. Can you link a source that explains the issue and that solution?
@Sloth bear Excuse my ignorance but how do I do that?
European sprat
they changed something in .13 i think that made it so you needed to add the hostname in docker
nyxzOP
ðŸ‘
nyxzOP
I just want to update here -
ENV HOSTNAME 0.0.0.0 actually worked. My browser seem to have cached the redirect to the wrong IP. I was able to verify the routing happens correctly with curl -v. After a while the browser started redirecting correctly as well.