Skip to content

Query compiler displays confusing error message when connection cannot be established #28055

@tobiasdiez

Description

@tobiasdiez

Bug description

Using the new prisma-client and the postgres db adapter, I got the following error message:

"PrismaClientKnownRequestError: ",
          "Invalid `prisma.user.findUnique()` invocation:",
          "",
          "",
          "",
          "    at di.handleRequestError (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:81:7283)",
          "    at di.handleAndLogRequestError (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:81:6608)",
          "    at di.request (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:81:6315)",
          "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
          "    at async a (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:90:9551)",
          "    at async AuthService.getUserById (file:///C:/home/site/wwwroot/functions/chunks/_/nitro.mjs:7008:12)",
          "    at async Query.user (file:///C:/home/site/wwwroot/functions/chunks/_/nitro.mjs:7408:12)"
        ]

Apart from the fact that it's triggered in the findUnique call, this doesn't contain any helpful information.

Patching prisma to simply rethrow the underlying exception in handleRequestError revealed that the connection string was wrong:

	"AggregateError [EACCES]: ",
        "    at C:\\home\\site\\wwwroot\\functions\\node_modules\\pg-pool\\index.js:45:11",
        "    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)",
        "    at async PrismaPgAdapter.performIO (file:///C:/home/site/wwwroot/functions/node_modules/@prisma/adapter-pg/dist/index.mjs:618:22)",
        "    at async PrismaPgAdapter.queryRaw (file:///C:/home/site/wwwroot/functions/node_modules/@prisma/adapter-pg/dist/index.mjs:568:30)",
        "    at async C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:71:12688",
        "    at async qn (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:71:12527)",
        "    at async e.interpretNode (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:71:30949)",
        "    at async e.interpretNode (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:71:31373)",
        "    at async e.interpretNode (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:71:32539)",
        "    at async e.run (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:71:29816)",

Severity

⚠️ Major: Breaks core functionality (e.g., migrations fail)

Reproduction

No reproduction atm (happened on Azure)

Expected vs. Actual Behavior

See above

Frequency

Consistently reproducible

Does this occur in development or production?

Only in production (e.g., query engine, generated client)

Is this a regression?

No

Workaround

Patching prisma as above

Prisma Schema & Queries

// Add relevant schema.prisma snippet
// Add relevant Prisma Client query

Prisma Config

// Add your `prisma.config.ts`

Logs & Debug Info

// Debug logs here

Environment & Setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

Latest

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions