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.

Using withScope with the Lazy Loader

See original GitHub issue

Package + Version

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

Version:

Latest

Description

Because the full Sentry script is only injected with a call to capture or an error is captured on the page, code like this below will (virtually) never execute.

Sentry.withScope((scope) => {
  scope.setLevel('warning')
  Sentry.captureException(error)
})

In particular, withScope will simply get placed on the queue, and unless an error occurs or you call Sentry.forceLoad() right after, it will not bubble up to Sentry.

I think at the very least the documentation should make a note of this. Potentially though, withScope should trigger an inject as well.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
PrimarchAlphariuscommented, Nov 13, 2020

I’m having the same problem, I guess I’ll just have to call forceLoad

0reactions
amatiashcommented, Mar 25, 2020

I have the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use lazy loading to improve loading speed - web.dev
This post explains lazy loading and why you might want to lazy-load elements on your site.
Read more >
Ng-repeat and Native scrolling creating issue with scope loading ...
This issue happens on hybrid app. The longer list (and images) the more lag it has. As I can see you are using...
Read more >
Javascript – Working example of datatables with lazy loading of ...
I'm looking for a working example of lazy-loading of images within datatables ... The method I've had the most success with uses the...
Read more >
Lazy-Loading Sentry for JavaScript
When to load the SDK. SDK Version. To configure the version, use the dropdown in the JavaScript Loader settings, directly beneath the script...
Read more >
Eloquent: Getting Started - Laravel - The PHP Framework For ...
If you need to eager load relationships, consider using the lazy method instead. Internally, the cursor method uses PHP generators to implement ...
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