slower session lookup in prod than local
not sure if anyone else has encountered this issue (next-auth stable v4) but it's weird to see that calling
/session
locally takes 30-40ms (pic 1) but on production it goes up to 400-500ms (pic 2) (which I think is because it's not cached? not using the provider?) I'm attaching screenshots and my root layout.tsx
Note: I'm NOT using a local db on local dev, both instances are connecteed to planetscale through regular connection strings

2 Replies
the layout.tsx
the
AuthProvider
There's a few things you can check:
1 - Network issue: check if your deployment is in the same region as your database. When in dev mode, your client and server are the same, so, its your machine -> db -> your machine. When in prod, its your machine -> server > db -> server -> your machine.
2 - Execution issue: log the execution time of the login logic and check the log on the server.
3 - Build issue(?): Build your project locally and test the built version of it