Missing stacktrace in renderer process when using Node.js API integration
See original GitHub issue- Review the documentation: https://docs.sentry.io/platforms/javascript/electron/
- Search for existing issues: https://github.com/getsentry/sentry-electron/issues
- Use the latest release: https://github.com/getsentry/sentry-electron/releases
- Provide a link to the affected event from your Sentry account
Versions + Platform
- SDK version -
@sentry/electron@v2.4.0
- Electron version -
electron@v11.0.4
- Platform -
macOS
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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Missing stack trace on node.js uncaughtException generated ...
Disclaimer: I know that using process.on('uncaughtException') is a very, very bad thing and I will be punished but using domains is not an ......
Read more >Events | Node.js v19.3.0 Documentation
When a listener is registered using the eventEmitter.on() method, ... the error is thrown, a stack trace is printed, and the Node.js process...
Read more >Error Reporting - Node.js client library - Google Cloud
The stack trace associated with an error can be viewed in the error reporting console. If the errors.report method is given an ErrorMessage ......
Read more >Server-Side Rendering - Vite
SSR specifically refers to front-end frameworks (for example React, Preact, Vue, and Svelte) that support running the same application in Node.js, pre-rendering ......
Read more >How does JavaScript and JavaScript engine work in ... - Medium
If any function call at a given stack frame produces an error, JavaScript will print a stack trace which is nothing but a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, I haven’t been very clear there!
I understand your issue and it is caused by the fact that
@sentry/node
is not used in the renderer.I’m saying that to fix your issue,
@sentry/electron
needs to be modified to use@sentry/node
in the renderer and we need to ensure that exceptions are not caught twice.Besides, I looked again at my sample stacktrace and it seems there is nothing interesting into, it apart technical framework frames. No function from my application appear. I may have to create new Error objects if I want to have a good stracktrace. Or it is Sentry’s responsiblity?