refactor(server): Remove opbeat from dev tools

This commit is contained in:
Stuart Taylor
2018-05-17 15:26:44 +01:00
committed by Mrugesh Mohapatra
parent 13162cb53a
commit 0553bfe2ff
3 changed files with 2 additions and 28 deletions

View File

@ -99,7 +99,6 @@
"nodemailer-ses-transport": "^1.3.0", "nodemailer-ses-transport": "^1.3.0",
"normalize-url": "^1.3.1", "normalize-url": "^1.3.1",
"normalizr": "2.2.1", "normalizr": "2.2.1",
"opbeat": "^4.14.0",
"passport": "^0.4.0", "passport": "^0.4.0",
"passport-facebook": "^2.0.0", "passport-facebook": "^2.0.0",
"passport-github": "^1.0.0", "passport-github": "^1.0.0",

View File

@ -1,4 +1,3 @@
import opbeat from 'opbeat';
import debug from 'debug'; import debug from 'debug';
import { import {
@ -8,7 +7,6 @@ import {
const log = debug('fcc:middlewares:error-reporter'); const log = debug('fcc:middlewares:error-reporter');
const isOpbeatDisabled = !opbeat.appId;
export default function errrorReporter() { export default function errrorReporter() {
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
return (err, req, res, next) => { return (err, req, res, next) => {
@ -20,19 +18,5 @@ export default function errrorReporter() {
next(err); next(err);
}; };
} }
return (err, req, res, next) => { return (err, req, res, next) => next(err);
// handled errors do not need to be reported
// the report a message and redirect the user
if (
isOpbeatDisabled ||
isHandledError(err) ||
// errors with status codes shouldn't be reported
// as they are usually user messages
err.statusCode ||
err.status
) {
return next(err);
}
return opbeat.captureError(err, { request: req }, () => next(err));
};
} }

View File

@ -1,15 +1,6 @@
require('dotenv').load(); require('dotenv').load();
require('./utils/webpack-code-split-polyfill'); require('./utils/webpack-code-split-polyfill');
if (process.env.OPBEAT_ID) {
console.log('loading opbeat');
require('opbeat').start({
appId: process.env.OPBEAT_ID,
organizationId: process.env.OPBEAT_ORG_ID,
secretToken: process.env.OPBEAT_SECRET
});
}
const _ = require('lodash'); const _ = require('lodash');
const Rx = require('rx'); const Rx = require('rx');
const loopback = require('loopback'); const loopback = require('loopback');