Skip to content

Certain errors terminate process async with unhelpful error (e.g. incorrect user and/or password) #140

Open
@andyjy

Description

@andyjy

Steps to reproduce

Try connect to Neon with incorrect username and/or password

Expected result

error event listeners fire on NeonPool and the cause of the error as returned by the Neon postgres server is thrown up to the calling application code.

e.g. when using via the Prisma adaptor:

PrismaClientUnknownRequestError: 
Invalid `prisma.$executeRaw()` invocation:

Error in connector: Error querying the database: ERROR: no such user
    at Vn.handleRequestError (.../node_modules/@prisma/client/runtime/library.js:121:7530)
    at Vn.handleAndLogRequestError (.../node_modules/@prisma/client/runtime/library.js:121:6663)
    at Vn.request (.../node_modules/@prisma/client/runtime/library.js:121:6370)
    at async l (.../node_modules/@prisma/client/runtime/library.js:130:9617) {
  jse_shortmsg: 'PrismaClientUnknownRequestError: \n' +
    'Invalid `prisma.$executeRaw()` invocation:\n' +
    '\n' +
    '\n' +
    'Error in connector: Error querying the database: ERROR: no such user'

Actual result

An unhelpful error is thrown immediately, terminating the process async from the call site:

Error: Connection terminated unexpectedly
    at fn.<anonymous> (.../node_modules/@neondatabase/serverless/index.mjs:1250:44)
    at Object.onceWrapper (.../node_modules/@neondatabase/serverless/index.mjs:410:15)
    at fn.emit (.../node_modules/@neondatabase/serverless/index.mjs:397:12)
    at v.<anonymous> (.../node_modules/@neondatabase/serverless/index.mjs:1202:66)
    at v.emit (.../node_modules/@neondatabase/serverless/index.mjs:397:12)
    at WebSocket.<anonymous> (.../node_modules/@neondatabase/serverless/index.mjs:988:51)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:816:20)
    at WebSocket.dispatchEvent (node:internal/event_target:751:26)
    at fireEvent (node:internal/deps/undici/undici:11547:14)
    at TLSSocket.onSocketClose (node:internal/deps/undici/undici:11946:7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions