question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception on captureException() call

See original GitHub issue

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/node

SDK Version

7.11.1

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

Catch exception, call captureException.

Expected Result

Exception being reported to Sentry

Actual Result

/home/node/node_modules/@sentry/utils/cjs/misc.js:25
    crypto && crypto.getRandomValues ? () => crypto.getRandomValues(new Uint8Array(1))[0] : () => Math.random() * 16;
                                                                                      ^

TypeError: Cannot read properties of undefined (reading '0')
    at /home/node/node_modules/@sentry/utils/cjs/misc.js:25:87
    at /home/node/node_modules/@sentry/utils/cjs/misc.js:30:19
    at String.replace (<anonymous>)
    at Object.uuid4 (/home/node/node_modules/@sentry/utils/cjs/misc.js:29:46)
    at Hub.captureException (/home/node/node_modules/@sentry/hub/cjs/hub.js:130:86)
    at /home/node/node_modules/@sentry/node/cjs/integrations/onuncaughtexception.js:71:17
    at Hub.withScope (/home/node/node_modules/@sentry/hub/cjs/hub.js:98:7)
    at OnUncaughtException.handler (/home/node/node_modules/@sentry/node/cjs/integrations/onuncaughtexception.js:69:15)
    at process.emit (node:events:525:35)
    at process.emit (node:domain:489:12)
    at process._fatalException (node:internal/process/execution:167:25)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
shellscapecommented, Sep 18, 2022

I’m getting this same error, but for exception while calling captureException.

TypeError: Cannot read properties of undefined (reading 'exception')
  File "/node_modules/.pnpm/@sentry+node@6.19.7/node_modules/@sentry/src/integrations/linkederrors.ts", line 59, in e._handler
  File "/node_modules/.pnpm/@sentry+node@7.12.1/node_modules/@sentry/src/integrations/linkederrors.ts", line 10, in <anonymous>
  File "/node_modules/.pnpm/@sentry+hub@7.12.1/node_modules/@sentry/src/scope.ts", line 515, in <anonymous>
  File "/node_modules/.pnpm/@sentry+utils@7.12.1/node_modules/@sentry/src/syncpromise.ts", line 58, in new is
  File "/node_modules/.pnpm/@sentry+hub@7.12.1/node_modules/@sentry/src/scope.ts", line 510, in BA._notifyEventProcessors
...
(4 additional frame(s) were not displayed)

How is the error handling within the sentry node package so extremely poor, that errors like this bubble up with vague messaging instead of being caught within the lib, with proper custom errors (with codes) thrown? This is basic package authoring stuff folks.

1reaction
lforstcommented, Sep 13, 2022

There is some funky stuff going on in the kafkajs package: https://github.com/tulios/kafkajs/blob/master/src/producer/partitioners/legacy/randomBytes.js

I can’t pinpoint the exact problem yet but I bet it has to do with this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Usage | Sentry Documentation
You can use captureException to manually report errors: JavaScript ... This means it should probably make an explicit process.exit() call.
Read more >
Using Sentry - errors, or all messages? ; Logging versus ...
get_logger(), and whenever I call logger.error(), it will pass to Sentry? Or I can just put client.captureException() into my exception handling code.
Read more >
Usage — raven-js 3.4.0 documentation - Read the Docs
The simplest way, is to try and explicitly capture and report potentially problematic code with a try...catch block and Raven.captureException . try { ......
Read more >
How to log error in catch statement in sentry - Stack Overflow
For some SDKs, you can also omit the argument to captureException and Sentry will attempt to capture the current exception.
Read more >
8. Errors and Exceptions — Python 3.11.1 documentation
Errors detected during execution are called exceptions and are not unconditionally fatal: you ... They include SystemExit which is raised by sys.exit() and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found