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.

Console errors are not captured with custom client and hub

See original GitHub issue

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.15.5

Description

<script src="https://browser.sentry-cdn.com/5.15.5/bundle.min.js" integrity="sha384-wF7Jc4ZlWVxe/L8Ji3hOIBeTgo/HwFuaeEfjGmS3EXAG7Y+7Kjjr91gJpJtr+PAT" crossorigin="anonymous"></script>
<script src="https://browser.sentry-cdn.com/5.15.5/reportingobserver.min.js" crossorigin="anonymous"></script>
<script src="https://browser.sentry-cdn.com/5.15.5/captureconsole.min.js" crossorigin="anonymous"></script>
<script src="https://browser.sentry-cdn.com/5.15.5/dedupe.min.js" crossorigin="anonymous"></script>

var SentryClientGlobal = new Sentry.BrowserClient({
        environment: 'development',
        dsn: 'secret',
        integrations: [
            ...Sentry.defaultIntegrations,
            new Sentry.Integrations.ReportingObserver(),
            new Sentry.Integrations.CaptureConsole({
                levels: ['error', 'warn']
            }),
            new Sentry.Integrations.Dedupe()
        ]
    }),
    SentryHubGlobal = new Sentry.Hub(SentryClientGlobal);    

// Capture additional data 
SentryHubGlobal.configureScope(function(scope) {
    scope.setTag("siteid", SITEID);
    scope.setTag('cID', CID);
    if (LOGGED_IN) {
        scope.setUser({ id: "<?= $u->uID ?>" });
    }
});

console.error('Boom!'); // this is not captured in Sentry

Initializing a client and hub manually like this doesn’t capture the console errors that are otherwise logged if I just use Sentry.init() and Sentry.configureScope normally as mentioned in the docs.

What am I doing wrong here or is it a bug?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kamilogorekcommented, Jun 9, 2020

Got it. And excuse me the long response time, I’ll try to be more responsive next time.

0reactions
kamilogorekcommented, Jun 10, 2020

@3zzy definitely! Coming in the next release 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Console errors are not captured with custom client and hub
Initializing a client and hub manually like this doesn't capture the console errors that are otherwise logged if I just use Sentry.init() and ......
Read more >
Capture console JS errors - Browser - New Relic Explorers Hub
Hello, I am tracking JS errors using New Relic but just realized it only captures thrown errors. Is there anyway to intercept the...
Read more >
How to handle SignalR server exception at client?
I tested on a little chat project (downloaded here) it seems this method handle only connection errors.
Read more >
Identify and resolve client errors
Identify client errors and resolve them in client-side scripts. ... Build a custom template from an existing application.
Read more >
Fix JavaScript errors that are reported in the Console
But no h2 element exists, so the script fails. Find and debug network issues. The Console also reports network errors. Demo page: Network...
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