Skip to content

TypeError: Cannot read properties of undefined (reading 'stack') #46

Open

Description

@aminya

This package is a dependency of ts-node. When I use ts-node, @cspotcode/source-map-support fails with this error:

/home/runner/work/test/node_modules/.pnpm/@cspotcode+source-map-support@0.8.1/node_modules/@cspotcode/source-map-support/source-map-support.js:681
var match = /\n    at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
                                                            ^
TypeError: Cannot read properties of undefined (reading 'stack')
    at getErrorSource (/home/runner/work/test/node_modules/.pnpm/@cspotcode+source-map-support@0.8.1/node_modules/@cspotcode/source-map-support/source-map-support.js:681:64)
    at printFatalErrorUponExit (/home/runner/work/test/node_modules/.pnpm/@cspotcode+source-map-support@0.8.1/node_modules/@cspotcode/source-map-support/source-map-support.js:714:16)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (/home/runner/work/test/node_modules/.pnpm/@cspotcode+source-map-support@0.8.1/node_modules/@cspotcode/source-map-support/source-map-support.js:753:9)
    at process.exit (node:internal/process/per_thread:189:15)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (/home/runner/work/test/node_modules/.pnpm/@cspotcode+source-map-support@0.8.1/node_modules/@cspotcode/source-map-support/source-map-support.js:750:17)
    at process._fatalException (node:internal/process/execution:167:25)
    at loadESM (node:internal/process/esm_loader:94:31)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)
 ELIFECYCLE  Command failed with exit code 7.

I am test this on Node 16.17.0 with ts-node --swc --esm ./some_code.ts on Linux. This doesn't happen on Windows.

Activity

  1. aminya commented on Aug 28, 2022

    @aminya
    Author

    I realized that one of the packages throws an undefined as an error in an awaited promise.

    Compiling the code and running Node directly gives this error:

    node:internal/process/esm_loader:97
        internalBinding('errors').triggerUncaughtException(
                                  ^
    undefined
    Thrown at:
        at loadESM (node:internal/process/esm_loader:97:31)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
  2. GodBleak commented on Aug 28, 2022

    @GodBleak

    Had this exact problem the other day as well. If throwing undefined can be handled with a bit more grace, hopefully, someone else doesn't have to rack their head for hours trying to find the source of this ambiguous error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions