Next.js Discord

Discord Forum

Too many database connection attempts are curre

Answered
Bracco Italiano posted this in #help-forum
Open in Discord
Bracco ItalianoOP
Hey guys, my nextjs app just crashed from this error, this is the first time that has ever happened to me. If anyone could help me out on this i would really appreciate it. This the error i get from the logs. This happened after a QStash callback which calls an endpoint of my app. The QStash callback base url starts with the apps custom domain
Answered by B33fb0n3
when using databases, you first get a connection to your DB and then executed queries via that connections. But when there are too many open connections, there can't be even more and an error is throws. The key point here is "too many connections". So you want to close your connections, after you used them. Either do it inside your code while using something like a "close" function (is always different, depending on what you using) or configure an idle timeout, so your DB closes the connection, that is inactive, after X seconds
View full answer

6 Replies

@Bracco Italiano Hey guys, my nextjs app just crashed from this error, this is the first time that has ever happened to me. If anyone could help me out on this i would really appreciate it. This the error i get from the logs. This happened after a QStash callback which calls an endpoint of my app. The QStash callback base url starts with the apps custom domain
when using databases, you first get a connection to your DB and then executed queries via that connections. But when there are too many open connections, there can't be even more and an error is throws. The key point here is "too many connections". So you want to close your connections, after you used them. Either do it inside your code while using something like a "close" function (is always different, depending on what you using) or configure an idle timeout, so your DB closes the connection, that is inactive, after X seconds
Answer
@B33fb0n3 > it was an error so is the issue already solved?
Bracco ItalianoOP
Yup, all g now, still will look more into concurrent db connections now that this happened