-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEXTAUTH_URL_INTERNAL=http://nextjs:3000 fails in docker using next-auth 4.20.1 #6949
Comments
I am also seeing this when running in Docker and with a I believe the cause is the PR to priortize NEXTAUTH_URL_INTERNAL, which was merged into the v4 branch a couple of weeks ago. If I patch out that change then the |
The problem is that on the client end I am seeing when I visit
clearly that is meant to be my how can I fix this?
|
We get a similar issue too. We use Since one of the latest patches, users are redirected to |
Our docker based app also breaks since the PR mentioned above has been introduced. Redirects to a docker-compose service name instead of the actual hostname. Will try to downgrade to next-auth@4.19.2 and see how it goes. Seems to break every docker based deployment. |
It's broken from 4.11.0 and above. |
@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. |
interesting, this is my .env.local
could you tell me if this is the same in yours? Should not we use our own database login and not a 3rd party login service like Google or Apple etc. Maybe that's the difference? |
This is breaking our app. The login button redirects the browser to the internal URL now. NextAuth 4.19.2 is the last working version. |
What is your .env.local file. Trying to work out why ours is breaking from 4.11.0 and up vs other people it seems to work all the way to 4.19.2 Any assistance with why yours is working would be great. |
@redimongo, for us the problem only occurs on our Kubernetes environment, because the API container using next-auth needs to talk to the Kubernetes service directly, not via the FQDN. But basically our environment looks similar to yours:
I think, the client-side of Next-Auth is not supposed to use the internal URL when the user clicks the provider "Sign in" button. In our case, hitting "Sign in" sends the browser to |
Even weirder and worse is that with NextAuth 4.20.1 I was able to use our application without being logged-in at all! So basically, the mechanism of using a Next
which is supposed to redirect the user if they're not logged in, wasn't working anymore 😱 |
So can anyone open this as a bug and see if we can get it fixed. Otherwise am stuck using an old version |
I agree with @redimongo. I discovered that the whole Can you shed some light on this, @balazsorban44? 🙏 |
We are experiencing this issue as well running nextjs app in Docker container via AWS ECS |
Here's my workaround to make v4.20.1 work the same as before.
Note that there is no guarantee this works for future versions. Make sure the installed version of next-auth is fixed to 4.20.1 |
Experienced issues with the redirectURI going to the NEXTAUTH_INTERNAL url instead of the NEXTAUTH url. Took me way too long to find the cause of this redirect because it only happend one of the pipelines, where this structure was required. Have currently fixed the version to 4.19.2. |
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? |
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... |
Yep, same issue here, wrong redirects after login and signout after updating from |
Can someone label it as a bug? |
I think this change causes the problem #6814 This is probably a breaking change @ThangHuuVu. If you have both |
it's hard to believe that the PR didn't pass checks and has no regression tests. The checklist in the template wasn't even checked. |
thank you, this fixed issue, waiting for developers fix this in their release |
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! |
Hi, we reverted the breaking change, you can upgrade to We agree that the undocumented change was not ideal and will try to avoid similar changes in the future. 🙏💚 Have a nice day! |
I just added ENV HOSTNAME 0.0.0.0 |
Hi, I'm running into the same issue, without @julortiz's tip (thanks a lot by the way) I couldn't resolve the problem Versions used:
|
i'm use this version, but same problem. Can you share your .env? NEXTAUTH_URL=http://localhost:3000 |
I've just: |
I don't know why, but i get this error when i run with docker, but with npm run works POST http://localhost:3000/api/auth/callback/credentials 401 (Unauthorized) My DockerFile
my docker-compose
My .env
|
Are you using oidc with a IDP like keycloack? |
No, i'm using credentials by next-auth |
have you found the solution? |
Have you found the solution? @murillo-vx |
This does not appear to be solved, why was it closed ? Is there an workound ? |
Please open a new issue if you think there is a bug :) |
Question 💬
I am having issues with this with the latest version 4.20.1 and while running in a docker container.
I am using
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 issuesContributing 🙌🏽
Yes, I am willing to help answer this question in a PR
The text was updated successfully, but these errors were encountered: