Reference

Vercel Postgres Error Codes

This section focuses on errors that can happen while using the Vercel Postgres SDK to interact with your Vercel Postgres store.
Table of Contents
ReplyError: invalid_connection_string

Your postgres client was not able to connect to your Postgres store. This error happens if you provided the wrong type of connection string to a connection method.

For example, you passed a non pooling postgres URL to the createPool method which expects a postgres URL that includes pooling.

Troubleshoot:

  • Check that your connection string does not have a typo, or that it is associated with the correct type of connection (direct or pooled)
ReplyError: missing_connection_string

Your postgres client was not able to connect to your Postgres store. This error happens if you did not provide a connection string when using a method that creates a connection with your Postgres store.

Troubleshoot:

This error occurs when the amount of concurrent connections available have been exhausted. When this is encountered, it is highly likely the result of a direct connection. The recommendation is to use the pooled connection instead.

ReplyError: kysely_streaming_not_supported

This error happens if you tried to use the streaming feature with the Kysely client. The Neon package does not support streaming.

ReplyError: kysely_transactions_not_supported

This error happens if you tried to use the transactions feature with the Kysely client. The Neon package does not support transactions.

This error is thrown when attempting to perform a Prisma migration using the pooled database connection, you need to use the direct connection when performing Prisma migrations.

This can be accounted for in the schema.prisma file to avoid needing to change connection strings by using a setup similar to the following:

schema.prisma
datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_DATABASE_URL")
}

While the database will primarily use the url variable for connections (likely to be pooled), it will default to the directUrl when attempting to perform migrations.

This error means that the connection was established. However, the Prisma query engine was unable to process a query in the connection pool within the time limit (the default is 10 seconds).

There are several ways to fix this error:

  1. Increasing the connection pool size

    You can increase the connection pool size by setting the connection_limit parameter to a higher value. We recommend increasing this value in increments of 10 until Prisma Client is working properly. You can learn more about optimizing the connection pool size in Prisma's documentation.

    The connection string would be:

    .env
    DATABASE_URL=postgres://default:<password>@ep-lingering-cell-123456.eu-central-1.postgres.vercel-storage.com:5432/verceldb?pgbouncer=true&connect_timeout=10&connection_limit=10
  2. Analyzing and optimizing your queries

    One way to solve this issue is to either reduce the number of queries being executed in the connection pool (modifying your code or introducing a cache) or reduce the execution duration.

  3. Increasing the timeout duration of the connection pool

    The default is 10 seconds. We recommend increasing this timeout duration after you have increased the connection_limit otherwise, you can run out of RAM. You can learn more about optimizing the connection pool timeout in Prisma's documentation.

    .env
    DATABASE_URL=postgres://default:<password>@ep-lingering-cell-123456.eu-central-1.postgres.vercel-storage.com:5432/verceldb?pgbouncer=true&connect_timeout=10&connection_limit=10&pool_timeout=20

This error is thrown when attempting to use the pooled connection string with Prisma and the ?pgbouncer=true parameter is missing. Adding ?pgbouncer=true to the end of the query string will resolve this.

Last updated on October 6, 2024