question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prisma Migrate Failure exposes database connection parameters

See original GitHub issue

Bug description

Upon a permission failure in accessing the database, schema or tables, prisma migrate will error and expose the full database connection parameters to the logs.

How to reproduce

Steps to reproduce the behavior:

  1. Setup PRISMA schema and adapter (I was connecting in node to postgres)
  2. Create a migration
  3. Run the migration but change the db permission to deny access
  4. See error

Expected behavior

A database error without the credentials and connection properties being exposed

Prisma information

datasource db {
  provider = "postgresql"
  url      = env("POSTGRES_URL")
}

The error

actual values replaced with xxxx

with self=PostgresFlavour { url: PostgresUrl { url: Url { scheme: "postgresql", username: "xxxx", password: Some("xxxx"), host: Some(Domain("xxxx")), port: Some(5432), path: "/xxxx", query: Some("schema=xxx&statement_cache_size=0"), fragment: None }, query_params: PostgresUrlQueryParams { ssl_params: SslParams { certificate_file: None, identity_file: None, identity_password: <HIDDEN>, ssl_accept_mode: AcceptInvalidCerts }, connection_limit: None, schema: "xxxx", ssl_mode: Prefer, pg_bouncer: false, host: None, socket_timeout: None, connect_timeout: Some(5s), pool_timeout: Some(10s), statement_cache_size: 0 } }, features: BitFlags<MigrationFeature>(0b0) } connection=Connection(Postgres(PostgresUrl { url: Url { scheme: "xxxx", username: "xxxx", password: Some("xxxx"), host: Some(Domain("xxxx")), port: Some(5432), path: "/xxxx", query: Some("schema=xxxx&statement_cache_size=0"), fragment: None }, query_params: PostgresUrlQueryParams { ssl_params: SslParams { certificate_file: None, identity_file: None, identity_password: <HIDDEN>, ssl_accept_mode: AcceptInvalidCerts }, connection_limit: None, schema: "bambee-payroll", ssl_mode: Prefer, pg_bouncer: false, host: None, socket_timeout: None, connect_timeout: Some(5s), pool_timeout: Some(10s), statement_cache_size: 0 } }))

Environment & setup

  • OS: Alpine Docker
  • Database: Postgres (aurora)
  • Node.js version: 14.15.1
  • Prisma version: 2.19.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tomhoulecommented, Mar 29, 2021

This is bad — for now I will do a quick review of the migrate codebase to fix this and search for similar cases.

I also created an internal issue for us to spend time finding mechanisms to make sure it doesn’t happen again.

0reactions
uptownhrcommented, Mar 30, 2021

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration troubleshooting in development - Prisma
This guide describes how to resolve issues with Prisma Migrate in a development environment, which often involves resetting your database.
Read more >
Troubleshooting database outages and connection issues
Learn about the possible reasons your database might be down or not connected and what you can do to fix it.
Read more >
Prisma Migrate is Production Ready - Hassle-Free Database ...
prisma db push : Creates the database schema based on the Prisma schema without any migrations. Intended for use while locally prototyping.
Read more >
Migration troubleshooting in production - Prisma
Fixing failed migrations with migrate diff and db execute · prisma migrate diff which diffs two database schema sources to create a migration...
Read more >
Error when migrating models to database Prisma
I tried Introspect. But, my DB currently has no tables and that threw an error. I tried npx prisma migrate save -experimental b/c...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found