neondatabase / neondatabase/serverless

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

Open
#140 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
548
Forks
81
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by connecting to Neon with incorrect credentials through NeonPool, then inspect the package's asynchronous connection and error-handling path; the reported stack points to node_modules/@neondatabase/serverless/index.mjs. Done means the error event reaches NeonPool listeners and the server's authentication error is surfaced to the calling application instead of an unhelpful asynchronous termination.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, postgresql
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.