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

Using source map support removes details from some errors #305

Open
TymanWasTaken opened this issue Feb 4, 2022 · 1 comment
Open

Using source map support removes details from some errors #305

TymanWasTaken opened this issue Feb 4, 2022 · 1 comment

Comments

@TymanWasTaken
Copy link

I have a project using sequelize and is also written in typescript, so I use this package to show the typescript files in stack traces. However, when using this, all the important parts of sequelize's errors get removed for some reason.
Without source-map-support loaded:

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

Error
    at Query.run (/home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/dist/lib/dialects/postgres/query.js:50:25)
    at /home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/dist/lib/sequelize.js:313:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async PostgresQueryInterface.select (/home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/dist/lib/dialects/abstract/query-interface.js:396:12)
    at async Function.findAll (/home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/dist/lib/model.js:1119:21)
    at async MessageListener.exec (/home/tyman/Documents/YourApps_JS/dist/listeners/client/message.js:19:22) {
  name: 'SequelizeDatabaseError',
  parent: error: relation "Apps" does not exist
      at Parser.parseErrorMessage (/home/tyman/Documents/YourApps_JS/.yarn/cache/pg-protocol-npm-1.5.0-390f8d9ed8-b839d12caf.zip/node_modules/pg-protocol/dist/parser.js:287:98)
      at Parser.handlePacket (/home/tyman/Documents/YourApps_JS/.yarn/cache/pg-protocol-npm-1.5.0-390f8d9ed8-b839d12caf.zip/node_modules/pg-protocol/dist/parser.js:126:29)
      at Parser.parse (/home/tyman/Documents/YourApps_JS/.yarn/cache/pg-protocol-npm-1.5.0-390f8d9ed8-b839d12caf.zip/node_modules/pg-protocol/dist/parser.js:39:38)
      at Socket.<anonymous> (/home/tyman/Documents/YourApps_JS/.yarn/cache/pg-protocol-npm-1.5.0-390f8d9ed8-b839d12caf.zip/node_modules/pg-protocol/dist/index.js:11:42)
      at Socket.emit (node:events:390:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at Socket.Readable.push (node:internal/streams/readable:228:10)
      at TCP.onStreamRead (node:internal/stream_base_commons:199:23) {
    length: 104,
    severity: 'ERROR',
    code: '42P01',
    detail: undefined,
    hint: undefined,
    position: '190',
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'parse_relation.c',
    line: '1381',
    routine: 'parserOpenTable',
    sql: `SELECT "id", "name", "description", "guild", "questions", "rewardroles", "removeroles", "requiredroles", "customcommand", "closed", "cooldown", "minjointime", "createdAt", "updatedAt" FROM "Apps" AS "App" WHERE "App"."guild" = '916752657413181450';`,
    parameters: undefined
  },
  original: error: relation "Apps" does not exist
      at Parser.parseErrorMessage (/home/tyman/Documents/YourApps_JS/.yarn/cache/pg-protocol-npm-1.5.0-390f8d9ed8-b839d12caf.zip/node_modules/pg-protocol/dist/parser.js:287:98)
      at Parser.handlePacket (/home/tyman/Documents/YourApps_JS/.yarn/cache/pg-protocol-npm-1.5.0-390f8d9ed8-b839d12caf.zip/node_modules/pg-protocol/dist/parser.js:126:29)
      at Parser.parse (/home/tyman/Documents/YourApps_JS/.yarn/cache/pg-protocol-npm-1.5.0-390f8d9ed8-b839d12caf.zip/node_modules/pg-protocol/dist/parser.js:39:38)
      at Socket.<anonymous> (/home/tyman/Documents/YourApps_JS/.yarn/cache/pg-protocol-npm-1.5.0-390f8d9ed8-b839d12caf.zip/node_modules/pg-protocol/dist/index.js:11:42)
      at Socket.emit (node:events:390:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at Socket.Readable.push (node:internal/streams/readable:228:10)
      at TCP.onStreamRead (node:internal/stream_base_commons:199:23) {
    length: 104,
    severity: 'ERROR',
    code: '42P01',
    detail: undefined,
    hint: undefined,
    position: '190',
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'parse_relation.c',
    line: '1381',
    routine: 'parserOpenTable',
    sql: `SELECT "id", "name", "description", "guild", "questions", "rewardroles", "removeroles", "requiredroles", "customcommand", "closed", "cooldown", "minjointime", "createdAt", "updatedAt" FROM "Apps" AS "App" WHERE "App"."guild" = '916752657413181450';`,
    parameters: undefined
  },
  sql: `SELECT "id", "name", "description", "guild", "questions", "rewardroles", "removeroles", "requiredroles", "customcommand", "closed", "cooldown", "minjointime", "createdAt", "updatedAt" FROM "Apps" AS "App" WHERE "App"."guild" = '916752657413181450';`,
  parameters: {}
}

With source-map-support loaded:

/home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/lib/dialects/postgres/query.js:76
    const errForStack = new Error();
                        ^
Error: 
    at Query.run (/home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/lib/dialects/postgres/query.js:76:25)
    at /home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/lib/sequelize.js:642:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at PostgresQueryInterface.select (/home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/lib/dialects/abstract/query-interface.js:978:12)
    at Function.findAll (/home/tyman/Documents/YourApps_JS/.yarn/__virtual__/sequelize-virtual-8cc6ae77bf/0/cache/sequelize-npm-6.12.5-5a012ec055-b347e31d18.zip/node_modules/sequelize/lib/model.js:1789:21)
    at MessageListener.exec (/home/tyman/Documents/YourApps_JS/src/listeners/client/message.ts:15:16)
@samialdury
Copy link

Hi @TymanWasTaken,

I solved it by setting the handleUncaughtExceptions option to false.

import sourceMapSupport from 'source-map-support'

sourceMapSupport.install({
  environment: 'node',
  handleUncaughtExceptions: false,
})

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

2 participants