Skip to content

Commit

Permalink
fix: remove Bugsnag
Browse files Browse the repository at this point in the history
It is causing crashes in production
  • Loading branch information
aalemayhu committed Oct 31, 2023
1 parent bee3535 commit f6995b9
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 161 deletions.
99 changes: 0 additions & 99 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
"license": "MIT",
"dependencies": {
"@2anki/csv-to-apkg": "^1.4.4",
"@bugsnag/js": "^7.20.2",
"@bugsnag/plugin-express": "^7.19.0",
"@notionhq/client": "^2.2.9",
"@sendgrid/mail": "^7.7.0",
"aws-sdk": "^2.1359.0",
Expand Down
38 changes: 0 additions & 38 deletions src/lib/error/CrashReporter.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/lib/error/getErrorReporterApiKey.ts

This file was deleted.

11 changes: 3 additions & 8 deletions src/lib/error/sendError.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/* eslint-disable import/no-extraneous-dependencies */
import Bugsnag from '@bugsnag/js';

export const sendError = (error: unknown) => {
if (error instanceof Error) {
if (process.env.LOCAL_DEV === 'true') {
console.error(error);
} else if (process.env.NODE_ENV === 'production') {
Bugsnag.notify(error);
}
console.error(error);
} else {
console.log('unknown error '+ error);

Check failure on line 5 in src/lib/error/sendError.ts

View workflow job for this annotation

GitHub Actions / build (18.16.1)

Insert `·`
}
};
11 changes: 0 additions & 11 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ import favoriteRouter from './routes/FavoriteRouter';
import templatesRouter from './routes/TemplatesRouter';
import defaultRouter from './routes/DefaultRouter';

import CrashReporter from './lib/error/CrashReporter';
import { sendError } from './lib/error/sendError';

import { isStaging } from './lib/isStaging';
import { getDatabase, setupDatabase } from './data_layer';
import { getErrorReporterApiKey } from './lib/error/getErrorReporterApiKey';
function registerSignalHandlers(server: http.Server) {
process.on('uncaughtException', sendError);
process.on('SIGTERM', () => {
Expand All @@ -56,11 +54,6 @@ const serve = async () => {
app.use(express.json({ limit: '1000mb' }) as RequestHandler);
app.use(cookieParser());

const errorReporterApiKey = getErrorReporterApiKey();
if (errorReporterApiKey) {
CrashReporter.Configure(app, errorReporterApiKey);
}

if (isStaging()) {
app.use(morgan('combined') as RequestHandler);
}
Expand Down Expand Up @@ -98,10 +91,6 @@ const serve = async () => {
}
);

if (errorReporterApiKey) {
CrashReporter.AddErrorHandler(app);
}

app.use(
(
err: Error,
Expand Down

0 comments on commit f6995b9

Please sign in to comment.