Prisma Migrate Failure exposes database connection parameters
See original GitHub issueBug 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:
- Setup PRISMA schema and adapter (I was connecting in node to postgres)
- Create a migration
- Run the migration but change the db permission to deny access
- 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:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Thank you!