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
EDGE_FUNCTION_INVOCATION_TIMEOUT when using DrizzleAdapter | timeout Vercel edge functions #10773
Comments
having the same issue using prisma neon adaptor |
having the same issue with planetscale adapter |
I am having the same issue, I am using App Router (v14), Prisma, Neon and Next-Auth v5. |
I'm having the same issue while implementing Role Based authentication using Next-auth v5. Everything works fine in development but edge function get timed out in production. Note: It's not a Vercel issue as I've tried Netlify too and got the same result. Having this issue for two weeks now. Next-auth v4 doesn't have this kinda issues. But as I'm want to implement auth using v5, I've tried multiple ways of fixing this issue and nothing seems to be working :) |
Depending on your setup, you may be running into issues where your adapter is not "edge compatible" and is timing out trying to start it up, etc. Please check out our edge compatibility guide. If you've confirmed your adapter is "edge compatible", then you may also be doing too many DB actions in your middleware. The limit there seems to be "25s to begin returning data". That's an awfully long time though, so unless yuo're doing something extra heavy you shouldn't be hitting that limit without other issues I'd guess. Please provide some more details, like versions of all the relevant packages and some log output and we can try and figure out what's going on 🙏 |
This is the only log I have in production: Versions:
Here is my db instance:
My auth.ts:
And my middleware:
|
@Yvon-Data can you share the versions of all the relevant prisma packages as well? |
Of course!
|
Hmm okay so it looks like that should be "edge compatible", but your middleware / auth.js setup is relatively simple so I can't imagine its anything else other than the DB lookup in your jwt callback 🤔 Might be worthwhile testing another DB call in an unrelated edge api route, like shown in this prisma + planetscale doc: https://www.prisma.io/docs/orm/prisma-client/deployment/edge/deploy-to-vercel#planetscale, to see if you run into similar errors there or if that works as expected |
I downgraded next-auth to v4 and now its working like a charm. I was also using edge compatible prisma but the issue is with next-auth v5. |
Environment
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
The text was updated successfully, but these errors were encountered: