Closed avisra closed 1 year ago
Hi, this is likely not a Vercel issue. do you have a reproduction of a slow endpoint?
@balazsorban44 I have it on my test site, but I can't put that link here publicly. I'll setup a separate reproduction for you.
The endpoint that I'm currently try to make faster is the "/api/auth/session" endpoint. On Vercel, its 150 to 200ms. On a self-hosted nodejs server, its 20-30ms. Same code
Just guessing here as there was no reproduction provided, but it's probably related to https://github.com/nextauthjs/next-auth/issues/1535
So we introduced an API that does not even call /api/auth/session
, resulting in much better performance on serverless platforms. See the docs: https://next-auth.js.org/configuration/nextjs#unstable_getserversession
Also, we are working on being framework agnostic, which means you'll be able to run next-auth
on Edge Functions, further reducing cold starts.
See #2294 and #5536
yea, its been difficult with the holidays - I still plan to do this reproduction though.
Question 💬
If I host my entire application on Azure App Services, the session API calls (from client) are very fast - usually around 30ms. The provider is a self-hosted (in Azure) IdentityServer.
But, when my application is hosted by Vercel, that session API is hosted by Vercel's serverless functions. When hosted here, it takes 150ms to 200ms. And this is after the cold-start. During a cold start... this can vary from 8ms to 15ms.
I love everything that Vercel provides - but would like full control over the performance of my application. All of my other APIs are delivered from a Azure App Service - and they are very fast. Is there a way to externalize the session API so it is handled by an endpoint in my Azure App Services?
How to reproduce ☕️
Deploy a NextAuth application to Vercel and compare to a NextAuth application hosted on Azure App Services
Contributing 🙌🏽
No, I am afraid I cannot help regarding this