Long term connection or enabling a retry connection

I’m creating a rest api with NestJs & node, the application works fine if I’m continuously making queries however if I don’t make a query in lets say 5-10 minutes. The connection to the database will get disconnected.

error: terminating connection due to administrator command

I’m not sure if there is easy way to reconnect to the database, once it disconnects itself, because the application just throws an error once the database connection closes

1 Like

By default on the Neon Free Tier, your compute is placed into an idle state after 300 seconds (5 minutes of inactivity). You can read about that here:

On the Pro tier, you can extend or disable that timeout. That option and some other strategies are outlined here:

If none of those options meet your requirements, let us know. We’d be interested in knowing more about your use case and what might help.