NavigationContentFooter
Jump toSuggest an edit

Solving Serverless SQL Databases connection timeouts

Reviewed on 17 June 2024Published on 27 November 2023

Serverless SQL Databases is based on PostgreSQL engine, and thus provides standard PostgreSQL compatibility for most PostgreSQL features and commands. Due to autoscaling, the cold start can take a couple of seconds and be interpreted as an error by some drivers or third party libraries.

If you require strict compatibility with all PostgreSQL features, use Managed Databases for PostgreSQL instead.

Connection timeouts using Prisma

Prisma’s default connection timeout is 5 seconds. In some cases, when performing a prisma command, the following error will display:

Error: P1001
Can't reach database server at `{15ad0be1-5610-8b4c-8276-f4f38e1f7895}.pg.sdb.fr-par.scw.cloud`:`5432`
Please make sure your database server is running at `15ad0be1-5610-8b4c-8276-f4f38e1f7895.pg.sdb.fr-par.scw.cloud`:`5432`.

To fix this issue, set a higher connection timeout in the Prisma connection parameters, such as 10 seconds. Update your schema.prisma file or your .env file by adding ?pool_timeout=10&connect_timeout=10 at the end of your connection string:

datasource db {
provider = "postgresql"
url = "postgresql://{username}:{password}@{host}:5432/{databasename}?pool_timeout=10&connect_timeout=10"
}
Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway