Next.js Discord

Discord Forum

504 status in NextAuth signIn POST request (production)

Answered
lil slit wrist posted this in #help-forum
Open in Discord
Hello everyone, before the question, here is some details:

(English is not my main language)
- I've already set an Email Provider, following the HTTP-based Email Provider guide;
- The auth works in local, but in prod it doesn't;
- When testing, I receive the email correctly, but delayed like 2-3 minutes later and after the 504 status;
- When I coded, it worked in prod, but I don't know how it stopped working (I didn't changed the NextAuthOptions code since it worked);
- I'm using PlanetScale and Prisma as part of my DB.

As stated above, it works in local, but not in production, this is the 504 response:

An error occurred with your deployment

FUNCTION_INVOCATION_TIMEOUT

You can test it here:
https://next-auth-test-bay.vercel.app/login

This is part of a bigger project, I tried to isolate the problem in this Vercel app but did not succeeded

I checked the Vercel function logs for /api/auth/signin/login and this is what I got:

[POST] /api/auth/signin/login?nxtPnextauth=signin%2Flogin status=504
Task timed out after 10.03 seconds

I've attached some screenshots for better understanding.
Answered by lil slit wrist
I checked all of this and none resolved, it was actually React Email
View full answer

9 Replies

bump
Toyger
either your email sending sendVerificationRequest or database interaction db.user.findFirst,db.user.update...
getting too long to execute, comment out each of them separately or both to understand which one.
also possible that you entered wrong credentials for host or it just unreachable.
Answer
I don't know how, but it increases A LOT of the response time
from testing, this is the time with React Email, just by removing the logo attached (the logo was not even in local), it gets down to 9-10.05 sec
This is without React Email
surreal