chore: Bugsnag -> Sentry (#1178)
* Bugsnag -> Sentry * fix: Import style
This commit is contained in:
@ -10,8 +10,8 @@ import logger from 'koa-logger';
|
||||
import mount from 'koa-mount';
|
||||
import enforceHttps from 'koa-sslify';
|
||||
import Koa from 'koa';
|
||||
import bugsnag from 'bugsnag';
|
||||
import onerror from 'koa-onerror';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import updates from './utils/updates';
|
||||
|
||||
import auth from './auth';
|
||||
@ -46,12 +46,6 @@ if (process.env.NODE_ENV === 'development') {
|
||||
// that means no watching, but recompilation on every request
|
||||
lazy: false,
|
||||
|
||||
// // watch options (only lazy: false)
|
||||
// watchOptions: {
|
||||
// aggregateTimeout: 300,
|
||||
// poll: true
|
||||
// },
|
||||
|
||||
// public path to bind the middleware to
|
||||
// use the same as in webpack
|
||||
publicPath: config.output.publicPath,
|
||||
@ -89,23 +83,31 @@ if (process.env.NODE_ENV === 'development') {
|
||||
|
||||
// trust header fields set by our proxy. eg X-Forwarded-For
|
||||
app.proxy = true;
|
||||
}
|
||||
|
||||
// catch errors in one place, automatically set status and response headers
|
||||
onerror(app);
|
||||
// catch errors in one place, automatically set status and response headers
|
||||
onerror(app);
|
||||
|
||||
if (process.env.BUGSNAG_KEY) {
|
||||
bugsnag.register(process.env.BUGSNAG_KEY, {
|
||||
filters: ['authorization'],
|
||||
if (process.env.SENTRY_DSN) {
|
||||
Sentry.init({
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
environment: process.env.NODE_ENV,
|
||||
});
|
||||
|
||||
app.on('error', (error, ctx) => {
|
||||
// we don't need to report every time a request stops to the bug tracker
|
||||
if (error.code === 'EPIPE' || error.code === 'ECONNRESET') {
|
||||
console.warn('Connection error', { error });
|
||||
return;
|
||||
}
|
||||
|
||||
Sentry.withScope(function(scope) {
|
||||
scope.addEventProcessor(function(event) {
|
||||
return Sentry.Handlers.parseRequest(event, ctx.request);
|
||||
});
|
||||
Sentry.captureException(error);
|
||||
});
|
||||
app.on('error', (error, ctx) => {
|
||||
// we don't need to report every time a request stops to the bug tracker
|
||||
if (error.code === 'EPIPE' || error.code === 'ECONNRESET') {
|
||||
console.warn('Connection error', { error });
|
||||
} else {
|
||||
bugsnag.koaHandler(error, ctx);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
app.use(mount('/auth', auth));
|
||||
|
@ -1,7 +1,7 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import debug from 'debug';
|
||||
import bugsnag from 'bugsnag';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import nodemailer from 'nodemailer';
|
||||
import Oy from 'oy-vey';
|
||||
import { createQueue } from './utils/queue';
|
||||
@ -83,7 +83,7 @@ export class Mailer {
|
||||
attachments: data.attachments,
|
||||
});
|
||||
} catch (err) {
|
||||
bugsnag.notify(err);
|
||||
Sentry.captureException(err);
|
||||
throw err; // Re-throw for queue to re-try
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,18 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script
|
||||
src="https://browser.sentry-cdn.com/5.12.1/bundle.min.js"
|
||||
integrity="sha384-y+an4eARFKvjzOivf/Z7JtMJhaN6b+lLQ5oFbBbUwZNNVir39cYtkjW1r6Xjbxg3"
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
</script>
|
||||
<script>
|
||||
Sentry.init({ dsn: '<%= SENTRY_DSN %>' });
|
||||
|
||||
if (window.localStorage.getItem("theme") === "dark") {
|
||||
window.document.querySelector('#root').style.background = "#111319";
|
||||
}
|
||||
</script>
|
||||
<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-3.min.js" data-apikey="<%= BUGSNAG_KEY %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -5,7 +5,7 @@ import format from 'date-fns/format';
|
||||
import AWS from 'aws-sdk';
|
||||
import invariant from 'invariant';
|
||||
import fetch from 'isomorphic-fetch';
|
||||
import bugsnag from 'bugsnag';
|
||||
import * as Sentry from '@sentry/node';
|
||||
|
||||
const AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;
|
||||
const AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;
|
||||
@ -116,7 +116,7 @@ export const uploadToS3FromUrl = async (
|
||||
return `${endpoint}/${key}`;
|
||||
} catch (err) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
bugsnag.notify(err);
|
||||
Sentry.captureException(err);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
@ -149,7 +149,7 @@ export const getImageByKey = async (key: string) => {
|
||||
return data.Body;
|
||||
} catch (err) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
bugsnag.notify(err);
|
||||
Sentry.captureException(err);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
import fs from 'fs';
|
||||
import JSZip from 'jszip';
|
||||
import tmp from 'tmp';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import unescape from '../../shared/utils/unescape';
|
||||
import { Attachment, Collection, Document } from '../models';
|
||||
import { getImageByKey } from './s3';
|
||||
import bugsnag from 'bugsnag';
|
||||
|
||||
async function addToArchive(zip, documents) {
|
||||
for (const doc of documents) {
|
||||
@ -36,7 +36,7 @@ async function addImageToArchive(zip, key) {
|
||||
zip.file(key, img, { createFolders: true });
|
||||
} catch (err) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
bugsnag.notify(err);
|
||||
Sentry.captureException(err);
|
||||
} else {
|
||||
// error during file retrieval
|
||||
console.error(err);
|
||||
|
Reference in New Issue
Block a user