New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PrismaClientInitializationError
is missing expected error code
#10229
Comments
Having this issue as well. However running const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
async function main() {
try {
await prisma.$connect();
// const data = await prisma.$queryRaw`SELECT 1`;
} catch (error) {
// log error
console.log(error);
console.log('keys: ', Object.keys(error));
console.log('error.errorCode: ', error.errorCode);
console.log('error.code: ', error.code);
console.error(JSON.stringify(error, null, 2));
}
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
}); returns:
Edit: Maybe the issue is with the lazy connect behaviour? |
With this version:
I tested it again because this version resolved issue #10240 But it still returns error codes as |
The |
facing this issue in local environment it is working fine for development and production apis |
Bug description
When an error is caused during initialization for a PostgreSQL database, the exception
PrismaClientInitializationError
does not contain the expected error message:with a connection string that does not work (e.g.
postgresql://foo:bar@example.org:123/baz
) returns:(Same problem for
prisma.user.findMany({})
so this is not related to raw queries)Environment & setup
Prisma Version
3.4.2
Originally noticed via #10141
The text was updated successfully, but these errors were encountered: