Skip to content
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

next.js 14.2.1 gives 404 on /auth/signin #10585

Open
adriangalilea opened this issue Apr 14, 2024 · 15 comments
Open

next.js 14.2.1 gives 404 on /auth/signin #10585

adriangalilea opened this issue Apr 14, 2024 · 15 comments
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@adriangalilea
Copy link

adriangalilea commented Apr 14, 2024

Environment

System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M2 Pro
Memory: 258.67 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.7.1 - ~/.nvm/versions/node/v21.7.1/bin/node
npm: 10.5.0 - ~/.nvm/versions/node/v21.7.1/bin/npm
pnpm: 8.14.1 - ~/Library/pnpm/pnpm
bun: 1.1.1 - /opt/homebrew/bin/bun
Browsers:
Brave Browser: 121.1.62.162
Chrome: 123.0.6312.123
Safari: 17.4.1
npmPackages:
@auth/drizzle-adapter: ^0.8.0 => 0.8.0
next: 14.1.2 => 14.2.1
next-auth: ^5.0.0-beta.15 => 5.0.0-beta.15
react: ^18 => 18.2.0

Reproduction URL

https://github.com/adriangalilea/e-id

Describe the issue

when I use the signIn button it leads me to https://e-id.to/auth/signin?callbackUrl=https%3A%2F%2Fe-id.to%2F as per my atuh.ts

If the version of next.js is 14.1.2 it works great.

If the version of next.js is 14.2.1 it gives a 404, if I refresh after the 404, it works normally.

In the meantime I reverted to 14.1.2.

How to reproduce

above

Expected behavior

above

@adriangalilea adriangalilea added bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Apr 14, 2024
@patelvivekdev
Copy link

I encountered a 404 error when clicking the "Sign In" button after deploying the NextAuth.js example to Vercel.

Here's a breakdown of the issue:

Steps to Reproduce:

  • Clone the NextAuth.js example repository.
  • Deploy the project to Vercel.
  • Attempt to sign in using the provided button.

Expected Behavior:

The user should be redirected to the appropriate authentication flow.

Actual Behavior:

A 404 error page is displayed.

Workaround:

Downgrading Next.js to version 14.1.4 seems to resolve the issue.

@patelvivekdev
Copy link

When I tried following, it works with NextJs 14.2.1

Example Next14.2.1

@taskrider2022
Copy link

taskrider2022 commented Apr 15, 2024

I have a similar problem. When I log in, no redirect is performed. The url remains on /sign-in. If I then do a reload, I am redirected correctly. If I then log out, it does not redirect to the /sign-in page, but remains on the last page. With a downgrade to 14.1.4 this problem does not exist.

P.S. I use next-auth@5.0.0-beta.16

@adriangalilea
Copy link
Author

@patelvivekdev tried your suggestion and it does give me 404

@patelvivekdev
Copy link

@patelvivekdev tried your suggestion and it does give me 404

@adriangalilea Did you find it out any workaround?

P.S. I am using next-auth@5.0.0-beta.16

@adriangalilea
Copy link
Author

adriangalilea commented Apr 16, 2024

@adriangalilea Did you find it out any workaround?

Just staying on next 14.1.4 until this is solved.

@akif-work
Copy link

I'm facing a similar issue. Works by downgrading to next 14.1.4. I'm using next-auth@^4.24.7 .

@namadaza
Copy link

You folks are amazing ❤️

Was having the same issues of 404s on next 14.2.2, downgrading to 14.1.4 fixed it. If only folks outside of tech understood the value of open-source, the world would be a much better place.

@fernandomarca
Copy link

Same problem in Kubernetes
"next": "14.1.4" "next-auth": "^4.24.7"

 Next.js 14.1.4
- Local:        http://localhost:3000
- Network:      http://0.0.0.0:3000

[next-auth][error][SIGNIN_OAUTH_ERROR]
https://next-auth.js.org/errors#signin_oauth_error only valid absolute URLs can be requested {
error: {
message: 'only valid absolute URLs can be requested',
stack: 'TypeError: only valid absolute URLs can be requested\n' +
'    at e.exports (/app/.next/server/chunks/638.js:39:36528)\n' +
'    at _.discover (/app/.next/server/chunks/638.js:39:42111)\n' +
'    at o (/app/.next/server/chunks/638.js:6:129314)\n' +
'    at s (/app/.next/server/chunks/638.js:6:121669)\n' +
'    at Object.s (/app/.next/server/chunks/638.js:30:8642)\n' +
'    at _ (/app/.next/server/chunks/638.js:6:107014)\n' +
'    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
'    at async a (/app/.next/server/chunks/638.js:30:18310)\n' +
'    at async e.length.t (/app/.next/server/chunks/638.js:30:19720)\n' +
'    at async /app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:42484',
name: 'TypeError'
},
providerId: 'keycloak',
message: 'only valid absolute URLs can be requested'
}

@ndom91
Copy link
Member

ndom91 commented Apr 28, 2024

Yeah there seems to be an issue with next@14.2.0-canary.47+, we're aware and are looking into it 👍

@ndom91
Copy link
Member

ndom91 commented Apr 28, 2024

Hmm although, I just upgraded a project of mine that was having the issue as well to next@14.2.3 and it seems to work now.

Can anyoen else confirm that it may be fixed with next@14.2.3+? 🙏

@adriangalilea
Copy link
Author

adriangalilea commented Apr 28, 2024

Hmm although, I just upgraded a project of mine that was having the issue as well to next@14.2.3 and it seems to work now.

Can anyoen else confirm that it may be fixed with next@14.2.3+? 🙏

Works on localhost but not on prod for me, not sure why.

package.json

    "next": "^14.2.3",
    "next-auth": "^5.0.0-beta.17",
image image

And I can't see any error on logs.

repo

error is live on e-id.to, I may revert to 14.1.4 tomorrow, but in the meantime you can see the error is there still.

@fernandomarca
Copy link

fernandomarca commented Apr 29, 2024

Hmm embora, eu apenas atualizei um projeto meu que estava tendo o problema também e parece funcionar agora.next@14.2.3

Qualquer outra pessoa pode confirmar que pode ser corrigido com ? 🙏next@14.2.3+

@ndom91 That worked. But I had to reset the Nginx buffers as well.

@devinshoemaker
Copy link

devinshoemaker commented Apr 29, 2024

I have a similar problem. When I log in, no redirect is performed. The url remains on /sign-in. If I then do a reload, I am redirected correctly. If I then log out, it does not redirect to the /sign-in page, but remains on the last page. With a downgrade to 14.1.4 this problem does not exist.

P.S. I use next-auth@5.0.0-beta.16

I am having the same issue with the URL not changing after a redirect. 14.2.* seems to do this (including 14.2.3 the current latest), but downgrading to 14.1.4 fixes the issue.

If you checkout this branch and then downgrade the Next dep it fixes the e2e test.

devinshoemaker/next-auth-example#20

@alexrandaccio
Copy link

I am having the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

9 participants