NEXTAUTH_URL breaks ability to login or obtain CSRF token >= 5.0.0-beta.6 #10171
Unanswered
subvertallchris
asked this question in
Help
Replies: 2 comments
-
|
has this ever been resolved? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
going through the same thing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have been using Next Auth 5.0.0-beta.4 for some time now. I am implementing a custom login page as described in #9189 (comment). It uses a very simple
CredentialsProvider.Upon upgrade to 5.0.0-beta.6 or beyond, there are two issues:
getCsrfTokenfunction crashes. It reportsClientFetchError: Unexpected end of JSON input .Read more at https://errors.authjs.dev#autherror.I think this is due to the second error/api/auth/csrffails to load. The server log saysTypeError: next_dist_server_web_exports_next_request__WEBPACK_IMPORTED_MODULE_0__ is not a constructorThe stack trace points me to
reqWithEnvURL.I am confident this is related to the change here #9687. I am setting
NEXTAUTH_URLbecause my local dev environment islocalhost:3000. and when I clear that out, I am able to get a token and there are no errors on the page; however, thesignOut()function takes me to the defaultlocalhost:3000page and from there,signIn()takes me to the equivalent localhost page as well.If I explicitly set
basePathinauth.tsand provide bothbasePathandbaseUrlto<SessionProvider>, I'm able to use theNEXTAUTH_URLenvironment variable, thesignIn()function takes me to the right page, and I can login. ButsignOut()keeps sending me back tolocalhost:3000, even when explicitly setting acallbackUrl.This seems like a bug or a new configuration change was missed when upgrading to Beta 6.
Beta Was this translation helpful? Give feedback.
All reactions