-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The lazy loader for Sentry does not initialize a command queue for all of its methods (e.g. setTag) #27391
Comments
Routing to @getsentry/team-webplatform for triage. ⏲️ |
A quick workaround for now: depending on the environments you support, this can be mitigated using |
You can also use Sentry.configureScope((scope) => {
scope.setTags(...);
scope.setExtra(...);
}); |
@AbhiPrasad I'm aware of that, however, in this case I didn't intend on setting it only for a particular scope (was a global tag) @kamilogorek thanks! we're worked around this right now by adding additional null checks, but the proxy fallback does look more full-proof. |
configureScope(scope => {
scope.setTag("configure", "scope");
Sentry.captureMessage(...);
});
pushScope(scope => {
scope.setTag("push", "scope");
Sentry.captureMessage(...);
});
// more logic here and there
// will have tag: { configure: "scope" } from `configureScope` call
Sentry.captureException(error) |
Putting this on the backlog, @kamilogorek @AbhiPrasad please adjust if needed. |
I've added this to our backlog as something to consider. |
I will close this because we are unlikely to support this, we want to keep the loader minimal for now! |
Environment
SaaS (https://sentry.io/)
Version
No response
Steps to Reproduce
I'm currently using this code snippet —
to lazy load sentry onto my page. However, this script only seems to initialize a queue for some of sentry's methods.
Notably, methods like
setTag
andsetExtra
are missing.Expected Result
The loader script should buffer all of Sentry's public methods until the bundle is loaded — or if not, at-least provide
stubs for them so that users aren't caught unaware and don't have to add
null
checks when switching to the lazy snippet.Actual Result
Trying to access
window.Sentry.setTag
before the actual sentry bundle has loaded results in an error — because thesetTag
method isn't found.The text was updated successfully, but these errors were encountered: