Skip to content
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

Incorrect Stacktrace #3313

Open
ackava opened this issue Sep 14, 2024 · 0 comments
Open

Incorrect Stacktrace #3313

ackava opened this issue Sep 14, 2024 · 0 comments

Comments

@ackava
Copy link

ackava commented Sep 14, 2024

This is the code,

import pg from "pg";

try {
    const c = new pg.Client({ host: "192.168.0.155", port: 5432, user: "postgres", password: "abcd123", database: "db1234" });
    await c.connect();
} catch (error) {
    console.error(error);
}

The app crashes with following log

error: database "db1234" does not exist
    at Parser.parseErrorMessage (D:\git\github\entity-access\entity-access\node_modules\pg-protocol\dist\parser.js:283:98)
    at Parser.handlePacket (D:\git\github\entity-access\entity-access\node_modules\pg-protocol\dist\parser.js:122:29)
    at Parser.parse (D:\git\github\entity-access\entity-access\node_modules\pg-protocol\dist\parser.js:35:38)
    at Socket.<anonymous> (D:\git\github\entity-access\entity-access\node_modules\pg-protocol\dist\index.js:11:42)
    at Socket.emit (node:events:520:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:191:23) {
  length: 92,
  severity: 'FATAL',
  code: '3D000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'postinit.c',
  line: '1019',
  routine: 'InitPostgres'
}

The big problem with this error stack is, it doesn't give information about where the error has occurred.

There are various such places, and I can see that since original pg library is callback based and promisify is converting callback based functions to async variant, but this is a real big issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant