next-auth: NEXTAUTH_URL_INTERNAL=http://nextjs:3000 fails in docker using next-auth 4.20.1
Question ๐ฌ
I am having issues with this with the latest version 4.20.1 and while running in a docker container.
I am using
NEXTAUTH_URL_INTERNAL=http://nextjs:3000
as my docker name is nextjs it was working find when using 4.10.3
. Tried to upgrade and bam things broke.
How to reproduce โ๏ธ
create a docker image with a project using next-auth and start with version 4.10.3
then try and upgrade it and you run into issues
NEXTAUTH_URL_INTERNAL=http://nextjs:3000
Contributing ๐๐ฝ
Yes, I am willing to help answer this question in a PR
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 11
- Comments: 33 (2 by maintainers)
I find it weird that we havenโt seen a response by one of the maintainers for 2 weeks now given that multiple users are experiencing the upgrade to 4.20.1 as a breaking change. Can one of the maintainers please at least acknowledge/label this as a bug/unintended behavior?
Hi, we reverted the breaking change, you can upgrade to
4.21.0
!We agree that the undocumented change was not ideal and will try to avoid similar changes in the future. ๐๐
Have a nice day!
Hi all, weโre very sorry for the change in #6814 causing so much frustration for you ๐โโ๏ธ. Weโre aware of this and are actively working on a solution!
I agree with @redimongo.
I discovered that the whole
detectHost()
stuff which was introduced by #6814 and is probably responsible for the current behavior has already been removed since 4.20.1 was released? This suggests that these areas are currently in flux anyway. I suppose the client parts (e.g. react) of next-auth should never need to useNEXTAUTH_URL_INTERNAL
when constructing URLs because those URLs are almost never reachable from the public internet.Can you shed some light on this, @balazsorban44? ๐
I think this change causes the problem https://github.com/nextauthjs/next-auth/pull/6814
This is probably a breaking change @ThangHuuVu. If you have both
NEXTAUTH_URL
andNEXTAUTH_URL_INTERNAL
logging in successfully will redirect you to the internal one instead of the canonical one like before.@redimongo FYI we were successfully running v4.19.2 with a Next.js app in Docker without encountering the problem you described in this issue. It was only when I upgraded us to v4.20.1 that the problem occurred.
Can someone label it as a bug?
Same error here. Wrong redirect after login, with keycloak as IDP. Pinning it to 4.19.2 fixed it
Considering this was a minor upgrade; in our case Next auth was automatically upgraded -> so kinda hard to debugโฆ