sentry-javascript
sentry-javascript copied to clipboard
Even with defaultIntegrations = false I still get errors from other random places I don't track
Is there an existing issue for this?
- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [X] I have reviewed the documentation https://docs.sentry.io/
- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
7.110.0
Framework Version
No response
Link to Sentry event
https://osfdigital.sentry.io/issues/5224495754/?project=4507081585852416
SDK Setup
import * as Sentry from "@sentry/node";
import * as vscode from "vscode";
import { getDsn, getEnvironment, getRelease } from "./sentry";
import { OSFDigitalAllAiAuthenticationProvider } from "./authenticationProvider";
export function activate(context: vscode.ExtensionContext) {
const dsn: string = getDsn();
const release: string = getRelease(context);
const environment: string = getEnvironment(context);
const defaultIntegrations: boolean = false;
Sentry.init({dsn, release, environment, defaultIntegrations});
context.subscriptions.push(new OSFDigitalAllAiAuthenticationProvider(context));
}
export function deactivate() {}
Steps to Reproduce
I don't know how to reproduce this.
Expected Result
I have setup Sentry to capture errors generated by a VSC Extension I developed but for some reason I get errors from other extensions as well.
Since I setup defaultIntegrations = false
shouldn't I catch only the errors that I'm actually tracking with Sentry.captureException(err);
?
Why am I getting random errors from some other random extensions on VSC?
Is Sentry "global" and maybe because other people also use sentry in their own extensions there's some kind of conflict and error catching and reporting gets messed up?
Actual Result
Catch only the errors I manually track with Sentry.captureException(err);
.
What can be done to fix this?
You identified it already kind of. Sentry.init()
is global, meaning that if another part of the process is also initializing Sentry, data might get mixed up.
We generally advise not to use Sentry inside of some shared context (e.g. browser extensions, vscode extensions, ...) UNLESS you're using a client instance directly.
The following docs apply to browser extensions, but it is very similar with vscode extensions: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/
Awesome. In my case I assume I'll be using NodeClient. Thank you.
I'm attempting to use this code but I don't get any events in Sentry. Any idea what I'm missing?
public captureException(err: any) {
const client = new NodeClient({
dsn: SENTRY_DSN,
release: getRelease(this.context),
environment: getEnvironment(this.context),
integrations: [],
stackParser: defaultStackParser,
transport: makeNodeTransport,
});
const scope = new Scope();
scope.setClient(client);
client.init();
scope.captureException(err);
}
I'm attempting to use this code but I don't get any events in Sentry. Any idea what I'm missing?
public captureException(err: any) { const client = new NodeClient({ dsn: SENTRY_DSN, release: getRelease(this.context), environment: getEnvironment(this.context), integrations: [], stackParser: defaultStackParser, transport: makeNodeTransport, }); const scope = new Scope(); scope.setClient(client); client.init(); scope.captureException(err); }
If you set debug: true
in the client config, do you see any logs?
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀