When connecting to a non existing database server (or using invalid credentials), the Client error message does not include an Error Code
See original GitHub issueBug description
C:\Users\Jan\Documents\throwaway\timeoutTest>node script.js
PrismaClientInitializationError2 [PrismaClientInitializationError]:
Invalid `prisma.user.create()` invocation:
Can't reach database server at `lkjasdhfasdf.com`:`34234`
Please make sure your database server is running at `lkjasdhfasdf.com`:`34234`.
at cb (C:\Users\Jan\Documents\throwaway\timeoutTest\node_modules\@prisma\client\runtime\index.js:35104:17)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async main (C:\Users\Jan\Documents\throwaway\timeoutTest\script.js:8:17) {
clientVersion: '2.22.1',
errorCode: undefined
}
How to reproduce
- New folder,
npm init -y
,npm install -D prisma
,npx prisma init
- Add model to schema file
npx prisma generate
- Copy over script from https://github.com/prisma/prisma-examples/blob/latest/javascript/script/script.js
- Set
DATABASE_URL
to non existant one likepostgresql://johndoe:randompassword@lkjasdhfasdf.com:34234/mydb?schema=public
- Run
node script.js
- Observe the error message above
Expected behavior
The error message should also include a documented (https://www.prisma.io/docs/reference/api-reference/error-reference) error code.
Prisma information
see above
Environment & setup
- OS: Windows
- Database: PostgreSQL, MySQL
- Node.js version: v14.16.1
- Prisma version:
C:\Users\Jan\Documents\throwaway\timeoutTest>npx prisma -v
Environment variables loaded from .env
prisma : 2.22.1
@prisma/client : 2.22.1
Current platform : windows
Query Engine : query-engine 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules\@prisma\engines\query-engine-windows.exe)
Migration Engine : migration-engine-cli 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules\@prisma\engines\migration-engine-windows.exe)Introspection Engine : introspection-core 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary : prisma-fmt 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 60cc71d884972ab4e897f0277c4b84383dddaf6c
Studio : 0.379.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Solved: Credentials are missing or not valid. inner except...
I am trying to make a connection to on premise database with windows credintials with no luck. It fails with this message. Credentials...
Read more >Data Server Manager (DSM) shows "Invalid Credentials ... - IBM
Cause. DSM turns on the Invalid Credentials internal flag, when while connecting to the monitored database, DB2 returns -4214 error.
Read more >How To Fix The "Error Establishing a Database Connection" in ...
1. Check Your Database Login Credentials. The first thing to do is check to ensure your database login credentials are correct. This is...
Read more >LDAP Error Code 49 : Reset Machine Account Password of ...
This issue happens due to a mismatch in the machine account password stored in VMDIRD Database and the password used by services to...
Read more >Error message reference - Prisma
When the first query is executed. Errors that can occur include: The provided credentials for the database are invalid; There is no database...
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 seems to be an error in the typescript client. If I run the master branch of the query-engine I get:
Notice the error code is defined there. But I can reproduce the above error with prisma 3.5.0 in nodejs.
We are facing the same problems. Without the Codes it’s nearly impossible to handle errors in different ways. Thus, we would appreciate a short-term solution/bugfix.