Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = (release = process.env.SENTRY_RELEASE) => {
const sentryOptions = {
dsn: process.env.SENTRY_DSN,
release,
maxBreadcrumbs: 50,
attachStacktrace: true,
}
// When we're developing locally
if (process.env.NODE_ENV !== 'production') {
// Don't actually send the errors to Sentry
sentryOptions.beforeSend = () => null
// Instead, dump the errors to the console
sentryOptions.integrations = [
new SentryIntegrations.Debug({
// Trigger DevTools debugger instead of using console.log
debugger: false,
}),
]
}
Sentry.init(sentryOptions)
return {
Sentry,
captureException: (err, ctx) => {
Sentry.configureScope(scope => {
if (err.message) {
// De-duplication currently doesn't work correctly for SSR / browser errors
// so we force deduplication by error message if it is present
scope.setFingerprint([err.message])
function startSentry(config) {
const captureErrors = isErrorCaptureEnabled(config);
const isDevelopmentEnvironment = config.environment !== 'production';
Sentry.init({
...config.sentry,
integrations: [new Ember()],
release: config.APP.version.match(versionRegExp)[0],
beforeSend(event, hint) {
const error = hint.originalException;
// ignore aborted route transitions from the Ember.js router
if (error && error.name === 'TransitionAborted') {
return null;
}
//print everything to the console when not in production
if (isDevelopmentEnvironment && error) {
console.error(error);
}
if (!captureErrors) {
return null;
}
toastConfig[item].name,
toastConfig[item].payloadFunc,
toastConfig[item].options
);
});
/* eslint-disable-next-line */
const vue = new Vue({
el: '#app',
i18n,
router,
store,
render: h => h(getApp())
});
const integration = new Integrations.Vue({ Vue, attachProps: true });
Sentry.init({
dsn: 'https://2c4e977d74fd44d1b18083e63a3b265f@sentry.mewapi.io/1',
integrations: [integration],
maxBreadcrumbs: 0,
environment: BUILD_TYPE,
requestBodies: 'small',
release: NODE_ENV === 'production' ? VERSION : 'develop',
beforeSend(event) {
const network =
!store && !store.state && !store.state.network
? store.state.network.type.name
: '';
const service =
!store && !store.state && !store.state.network
? store.state.network.service
initialize() {
if (Config.isAnalyticsEnabled) {
// ERROR HANDLING
// eslint-disable-next-line global-require
this.errorFixer = require('@sentry/node');
this.errorFixer.init({
dsn: 'https://004caee3caa04c81a10f2ba31a945362@sentry.io/1795473',
release: `rnv@${pkg.version}`,
integrations: [new RewriteFrames({
root: '/',
iteratee: (frame) => {
if (frame.filename.includes(`rnv${path.sep}dist${path.sep}`) || frame.filename.includes(`rnv${path.sep}src${path.sep}`)) {
if (frame.filename.includes(`rnv${path.sep}dist${path.sep}`)) {
frame.filename = frame.filename.split(`rnv${path.sep}dist${path.sep}`)[1];
} else {
frame.filename = frame.filename.split(`rnv${path.sep}src${path.sep}`)[1];
}
} else if (frame.filename.includes(`${path.sep}node_modules${path.sep}`)) {
frame.filename = `node_modules/${frame.filename.split(`${path.sep}node_modules${path.sep}`)[1]}`;
}
return frame;
}
})]
});
import Vue from 'vue'
import * as Sentry from '@sentry/browser'
import * as Integrations from '@sentry/integrations'
if (__ENV.SENTRY_CONFIG) {
Sentry.init({
dsn: __ENV.SENTRY_CONFIG,
integrations: [
new Integrations.Vue({ Vue, logErrors: true }),
new Integrations.ExtraErrorData(),
],
release: __ENV.GIT_SHA1,
ignoreErrors: [
'ResizeObserver loop limit exceeded', // Chrome
'ResizeObserver loop completed with undelivered notifications', // Firefox
],
})
}
export default function configureSentry(overrides = {}) {
// This integrations prevent an appearing of errors to console, so it is enabled only for production
const enableVueIntegration = process.env.NODE_ENV === 'production'
const vueIntegration = new Integrations.Vue({ Vue: overrides.Vue, attachProps: true })
// > Electron SDK hasn't been updated to use 5.x yet
// So we have to patch integration
// https://github.com/getsentry/sentry-javascript/issues/2033
vueIntegration.setupOnce = vueIntegration.setupOnce.bind(vueIntegration, null, getCurrentHub)
configureSentryDefault({
...overrides,
Vue: null,
integrations(integrations) {
return [...integrations, enableVueIntegration && vueIntegration].filter(Boolean)
}
})
}
}
): void {
// tslint:disable: strict-comparisons
if (options.defaultIntegrations === undefined) {
options.defaultIntegrations = [
new ReactNativeErrorHandlers(),
new Release(),
...defaultIntegrations.filter(
i => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name)
),
new Integrations.Breadcrumbs({
console: false, // If this in enabled it causes problems to native calls on >= RN 0.60
fetch: false
}),
new DebugSymbolicator(),
new RewriteFrames({
iteratee: (frame: StackFrame) => {
if (frame.filename) {
frame.filename = frame.filename
.replace(/^file\:\/\//, "")
.replace(/^address at /, "")
.replace(/^.*\/[^\.]+(\.app|CodePush|.*(?=\/))/, "");
const appPrefix = "app://";
// We always want to have a tripple slash
frame.filename =
frame.filename.indexOf("/") === 0
? `${appPrefix}${frame.filename}`
: `${appPrefix}/${frame.filename}`;
}
return frame;
}
logger.init = (opts = {}) => {
genMethods()
if (DEBUG) {
window.Sentry = Sentry
return
}
const {Vue} = opts
const integrations = Sentry.defaultIntegrations
if (Vue) integrations.push(new Integrations.Vue({Vue}))
Sentry.init({
environment: DEBUG ? 'dev' : 'production',
release: 'v' + manifest.version,
dsn: SENTRY_DSN,
debug: DEBUG,
integrations,
})
Sentry.configureScope(async scope => {
scope.setTag('background', await isBackground())
})
}
public install() {
Sentry.init({
dsn: this.options.dsn,
integrations: [
new Integrations.Vue({ Vue: this.Vue, attachProps: true })
],
release: this.options.release,
environment: this.options.environment
});
}
if (!analytics) {
return;
}
const dsn = isProduction ? 'https://b0fb75c38ef4487dbf742f79c4ba62d2@sentry.servarr.com/12' :
'https://da610619280249f891ec3ee306906793@sentry.servarr.com/13';
sentry.init({
dsn,
environment: branch,
release,
sendDefaultPii: true,
beforeSend: cleanseData,
integrations: [
new Integrations.RewriteFrames({ iteratee: stripUrlBase }),
new Integrations.Dedupe()
]
});
sentry.configureScope((scope) => {
scope.setUser({ username: userHash });
scope.setTag('version', version);
scope.setTag('production', isProduction);
});
return createMiddleware();
}