Next.js Discord

Discord Forum

Next Auth does not work in production

Unanswered
Kurilian Bobtail posted this in #help-forum
Open in Discord
Kurilian BobtailOP
I have an application that uses next auth and it works perfectly in development, but in production when I try to log in, I receive the following error: https://my.domain.here/api/auth/error?error=fetch%20failed

I have another application that uses EXACTLY the same configuration and works perfectly in development and production, can anyone help me understand what is happening?

9 Replies

@American Fuzzy Lop Do you have the env variables set up on prod?
Kurilian BobtailOP
yes, all needed variables: NEXT_PUBLIC_API_URL, NEXTAUTH_SECRET, NEXTAUTH_URL
@Kurilian Bobtail yes, all needed variables: NEXT_PUBLIC_API_URL, NEXTAUTH_SECRET, NEXTAUTH_URL
American Fuzzy Lop
can you share the code for your auth route?
@American Fuzzy Lop can you share the code for your auth route?
Kurilian BobtailOP
do you talk about [...nextauth].js file?
American Fuzzy Lop
yes
@American Fuzzy Lop yes
Kurilian BobtailOP
Kurilian BobtailOP
@American Fuzzy Lop some idea?
American Fuzzy Lop
@Kurilian Bobtail sorry was at the gym, what error code are u getting besides the error message?