migrate deploy: Error: P1010: User `user` was denied access on the database `db.public`
See original GitHub issueBug description
migrate deploy throws Error: P1010: User user
was denied access on the database db.public
How to reproduce
run migrate deploy
Expected behavior
migrations should run and tables on the migration should be created
since this is a production deploy, no shadow database should be necessary as per the documentation:
The migrate deploy command:
- Does not issue a warning if an already applied migration is missing from migration history
- Does not detect drift (production database schema differs from migration history end state - for example, due to a hotfix
- Does not reset the database or generate artifacts (such as Prisma Client)
- Does not rely on a shadow database
the user used has grant all on the database schema and its a superuser
Prisma information
datasource db { provider = "postgresql" url = env("DATABASE_URL") }
postgresql://postgres:[pwd]@localhost:5432/postgres?schema=public
Environment & setup
- OS: CentOS Stream 9
- Database: PostgreSQL 13.7
- Node.js version: v16.14.0
Prisma Version
3.10.0
Issue Analytics
- State:
- Created a year ago
- Comments:17 (5 by maintainers)
Top Results From Across the Web
Prism V2 access denied to postgres database - Stack Overflow
When i run npx prisma migrate dev all i get is Error: P1010: User 'johndoe' was denied access on the database 'db.public' ....
Read more >Error message reference - Prisma
Prisma Client, Migrate, Introspection error message reference. ... P1010. "User {database_user} was denied access on the database {database_name} " ...
Read more >How to solve "User `postgres` was denied access on the ...
When I called some functions (example prisma.users.findAll()) in docker container I have error User 'postgres' was denied access on the database 'my_db.public' ...
Read more >Permission denied in Postgres [duplicate]
You've granted CREATE , CONNECT , and TEMPORARY privileges on the database to myuser but you haven't granted SELECT and INSERT table privileges...
Read more >Easy way to fix permission denied for database Postgres error
The permission denied for database Postgres error occurs due to the lack of certain privileges like CONNECT, CREATE, DEFAULT and so on.
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 FreeTop 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
Top GitHub Comments
For anyone running into this in the future, you have to map the port to another one, as the error (in my case) came from ports colliding.
Final
docker-compose.yml
:Then connect to it using
postgresql://postgres:postgres@localhost:5555/my-db?schema=public
Should work then!
no it does not, the error I get is the one posted above…