Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Caveats when deploying to AWS platforms (Prisma ORM v7) (/docs/orm/v7/prisma-client/deployment/caveats-when-deploying-to-aws-platforms)

For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL.

Known caveats when deploying to an AWS platform

Location: ORM > v7 > Prisma Client > Deployment > Caveats when deploying to AWS platforms

The following describes some caveats you might face when deploying to different AWS platforms.

Prisma ORM is compatible with AWS RDS Proxy. However, there is no benefit in using it for connection pooling with Prisma ORM due to the way RDS Proxy pins connections:

"Your connections to the proxy can enter a state known as pinning. When a connection is pinned, each later transaction uses the same underlying database connection until the session ends. Other client connections also can't reuse that database connection until the session ends. The session ends when Prisma Client's connection is dropped." - AWS RDS Proxy Docs

Prepared statements (of any size) or query statements greater than 16 KB cause RDS Proxy to pin the session. Because Prisma ORM uses prepared statements for all queries, you won't see any benefit when using RDS Proxy with Prisma ORM.

AWS Elastic Beanstalk is a PaaS-like deployment service that abstracts away infrastructure and allows you to deploy applications to AWS quickly.

When deploying an app using Prisma Client to AWS Elastic Beanstalk, Prisma ORM generates the Prisma Client code into node_modules. This is typically done in a postinstall hook defined in a package.json.

Because Beanstalk limits the ability to write to the filesystem in the postinstall hook, you need to create an .npmrc file in the root of your project and add the following configuration:

.npmrc
unsafe-perm=true

Enabling unsafe-perm forces npm to run as root, avoiding the filesystem access problem, thereby allowing the prisma generate command in the postinstall hook to generate your code.

Error: @prisma/client did not initialize yet

Section titled “Error: @prisma/client did not initialize yet”

This error happens because AWS Elastic Beanstalk doesn't install devDependencies, which means that it doesn't pick up the Prisma CLI. To remedy this you can either:

  1. Add the prisma CLI package to your dependencies instead of the devDependencies. (Making sure to run npm install afterward to update the package-lock.json).
  2. Or install your devDependencies on AWS Elastic Beanstalk instances. To do this you must set the AWS Elastic Beanstalk NPM_USE_PRODUCTION environment property to false.

When using Prisma ORM with AWS RDS Postgres, you may encounter connection issues or the following error during migration or runtime:

Bash
Error: P1010: User <username> was denied access on the database <database>

AWS RDS enforces SSL connections by default, and Prisma parses the database connection string with rejectUnauthorized: true, which requires a valid SSL certificate. If the certificate is not configured properly, Prisma cannot connect to the database.

To resolve this issue, update the DATABASE_URL environment variable to include the sslmode=no-verify option. This bypasses strict SSL certificate verification and allows Prisma to connect to the database. Update your .env file as follows:

Bash
DATABASE_URL=postgresql://<username>:<password>@<host>/<database>?sslmode=no-verify&schema=public

The sslmode=no-verify setting passes rejectUnauthorized: false to the SSL configuration via the pg-connection-string package. This disables strict certificate validation, allowing Prisma to establish a connection with the RDS database.

While using sslmode=no-verify can be a quick fix, it bypasses SSL verification and might not meet security requirements for production environments. In such cases, ensure that a valid SSL certificate is properly configured.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu