When there's an invalid value provided to prisma at runtime, it will result in an error, but that error doesn't contain a useful stack trace.
import "source-map-support/register"
import { prisma } from "./prisma/prisma"
prisma.$connect().catch((err) => {
console.log(err)
process.exit(1)
}).then(() => {
return prisma.user.findOne({ where: { id: null as any as string }})
}).then(() => {
process.exit(0)
})
❯ ts-node app.ts
(node:46264) UnhandledPromiseRejectionWarning: Error:
Invalid `prisma.user.findOne()` invocation in
/Users/prisma/projects/redacted/backend/app.ts:10:33
6 // process.exit(1)
7 }).then(() => {
8 return prisma.user.findOne({ where: { id: null as any as string }})
→ 9 }).then(() => {
where: {
id: null
~~~~
}
})
Argument id for where.id must not be null. Please use undefined instead.
at Qh.validate (/Users/prisma/projects/redacted/backend/node_modules/@prisma/client/runtime/src/runtime/query.ts:280:19)
at t._executeRequest (/Users/prisma/projects/redacted/backend/node_modules/@prisma/client/runtime/src/runtime/getPrismaClient.ts:883:16)
at /Users/prisma/projects/redacted/backend/node_modules/@prisma/client/runtime/src/runtime/getPrismaClient.ts:787:16
at AsyncResource.runInAsyncScope (async_hooks.js:186:9)
at t._request (/Users/prisma/projects/redacted/backend/node_modules/@prisma/client/runtime/src/runtime/getPrismaClient.ts:786:25)
at Object.then (/Users/prisma/projects/redacted/backend/node_modules/@prisma/client/runtime/src/runtime/getPrismaClient.ts:948:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:46264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:46264) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Since this is an unhandled promise rejection, no error is returned and you can't catch it, which is probably the same reason for not getting a useful stacktrace about where the error originated from.
Environment variables loaded from prisma/.env
@prisma/cli : 2.9.0
@prisma/client : 2.9.0
Current platform : darwin
Query Engine : query-engine 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/query-engine-darwin)
Migration Engine : migration-engine-cli 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary : prisma-fmt 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/prisma-fmt-darwin)
Studio : 0.296.0
Preview Features : atomicNumberOperations
✨ Done in 2.53s.
When there's an invalid value provided to prisma at runtime, it will result in an error, but that error doesn't contain a useful stack trace.
Since this is an unhandled promise rejection, no error is returned and you can't catch it, which is probably the same reason for not getting a useful stacktrace about where the error originated from.