Skip to content
Latchkey

Prisma "P3014: Prisma could not create the shadow database" in CI

Prisma Migrate creates a temporary "shadow database" to detect drift and validate migrations. P3014 means it could not create one - usually the database user lacks CREATE DATABASE, common on managed databases. This is deterministic.

What this error means

prisma migrate dev (or diff) fails with P3014, explaining it could not create the shadow database and suggesting a shadowDatabaseUrl. It fails the same way until permissions or a shadow URL are provided.

prisma
Error: P3014

Prisma Migrate could not create the shadow database. Please make sure
the database user has permission to create databases. Read more about
the shadow database (and workarounds) at https://pris.ly/d/migrate-shadow

Original error: permission denied to create database

Common causes

User lacks CREATE DATABASE

Managed databases (RDS, Cloud SQL, Neon) often deny CREATE DATABASE to the app user, so Prisma cannot create the shadow database automatically.

No dedicated shadow database configured

Without shadowDatabaseUrl, Prisma must create/drop a shadow database itself, which the environment may not permit.

How to fix it

Provide a dedicated shadow database URL

Point Prisma at a separate empty database it is allowed to use as the shadow.

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

Or grant CREATEDB to the CI user

  1. On a self-managed CI Postgres, grant the migration user CREATEDB.
  2. In CI you often control the database, so this is simplest there.
  3. Use migrate deploy (which needs no shadow database) for applying already-generated migrations.

How to prevent it

  • Configure shadowDatabaseUrl for environments where the user cannot create databases.
  • Use migrate deploy in CI for applying migrations (no shadow database needed).
  • This is deterministic - retrying without permission or a shadow URL fails identically.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →