nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
22.49k stars 2.98k forks source link

EDGE_FUNCTION_INVOCATION_TIMEOUT when using DrizzleAdapter | timeout Vercel edge functions #10773

Open tobiasmeyhoefer opened 2 weeks ago

tobiasmeyhoefer commented 2 weeks ago

Environment

Next Auth v5, Vercel, Neon, Drizzle

Reproduction URL

https://github.com/tobiasmeyhoefer/bitz

Describe the issue

In localhost everything works fine but when deployed with Vercel hitting this error every second or third request when the middleware gets called...

long waiting and then this example error message: [GET] [middleware: "middleware"] /browse reason=EDGE_FUNCTION_INVOCATION_TIMEOUT, status=504, user_error=true

I already tried different package versions and setting location near me

How to reproduce

you can clone and try to deploy it yourself or look here: https://bitz-ecru.vercel.app

Im using neon serverless database... one thing that is sus to me is that the file db.ts:

gets called every time, shouldn't the connection be established only once?

Expected behavior

no errors at all

wrod7 commented 1 week ago

having the same issue using prisma neon adaptor

Yvon-Data commented 6 days ago

having the same issue with planetscale adapter

kisankumavat85 commented 23 hours ago

I am having the same issue, I am using App Router (v14), Prisma, Neon and Next-Auth v5.