Close database connection every finished queries #2497
vzrenggamani
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
You can create your own database adapter and use I think Vercel has also 10s for the lambda execution time and it worked fine for me. You can also check this out #1477. Maybe @balazsorban44 can help you more. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I'm building a NextJS application that uses email as an authentication system. I'm trying to do a production deployment on Netlify hosting. https://github.com/asaurusedu/educlient-mitraapp
I am using a MySQL database which I put on a database server hosting in my country. I have granted access via Remote MySQL so that my database can be accessed via any IP or hostname.
Problems
Every time I login using email, I always get an error message:
Current Know Limitations & Why it is happen
After doing some simple research, I found out that Netlify limits the execution time of the function to just 10 seconds. I don't know why the execution time on NextAuth can exceed 10 seconds. I think nextauth persist the connection when requesting some queries into the database.
Netlify Functions Limitations
Possible Fixes and Enhancements
I think its better to close every database connection rather than creating new connection every user request in manner of persisting cookies check. I don't know if its is possible, just looking around for better solutions.
I would like to use database connection like : https://www.npmjs.com/package/serverless-mysql rather than convention mysql package.
Duct tape Solution
Recently, I use Firebase Firestore Database Instead MySQL that hosted on Indonesia. (Latency Issues)
Refers: asaurusedu/educlient-mitraapp#4 (comment)
Functions Logs (Using Firebase Firestore)
References
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions