Skip to content

Missing stacktrace in renderer process when using Node.js API integration #308

@clemp6r

Description

@clemp6r

Versions + Platform

Description

When capturing a exception thrown by the Node integration in the renderer process, the reported stacktrace is empty.

Sample code to reproduce:

  const exec = promisify(childProcess.exec);
  const command = `commandThatFails`;
  let stdout: string;
  try {
    const response = await exec(command);
    stdout = response.stdout;
  } catch (error) {
    console.log('got error', error);
    stdout = error.stdout;
    if (!stdout) {
      Sentry.captureException(error);
    }
  }

The console prints the following (we can see here the value of error.stack):

got error Error: Command failed: commandThatFails
/bin/sh: commandThatFails: command not found

    at ChildProcess.exithandler (child_process.js:312)
    at ChildProcess.emit (events.js:315)
    at maybeClose (internal/child_process.js:1021)
    at Socket.<anonymous> (internal/child_process.js:443)
    at Socket.emit (events.js:315)
    at Pipe.<anonymous> (net.js:674)

The error is correctly reported when calling Sentry.captureException(error) but in the Sentry web interface the stacktrace is empty. Only the first two lines appear:

Command failed: commandThatFails
/bin/sh: commandThatFails: command not found

It seems the Sentry client tries to parse the stack as a Chrome stack, but as the error comes from the Node integration, the format does not match and all frames are skipped.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions