Hi all
I am initializing Sentry at server start with the following code (Node/Typescript):
import * as Sentry from '@sentry/node';
Sentry.init({ dsn: process.env.SENTRY_URL, environment:process.env.ENV });
When I want to use this instance at other places within the server, can I just import it from the package as follows:
import * as Sentry from '@sentry/node';
Sentry.captureException(error);
Or do I need to re-initialize it again?
I was thinking that I could also create the initial Sentry instance as a const and export it so that I can easily import from the startup file at other places.
export const Sentry = require("@sentry/node");
Sentry.init({ dsn: process.env.SENTRY_URL, environment:process.env.ENV });
Thanks a lot!