diff --git a/server/src/index.ts b/server/src/index.ts index eb40d53f..06e9a8f2 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -20,7 +20,7 @@ if (!config.SENTRY_DSN) { throw new Error('SENTRY_DSN was not set in config.json'); } -Sentry.init({ dsn: config.SENTRY_DSN }); +Sentry.init({ dsn: config.SENTRY_DSN, tracesSampleRate: 1 }); const storage = new Storage({ projectId: config.PROJECT @@ -63,14 +63,16 @@ export function validateGeneratedFile(req: Request, res: Response) { contentType: 'text/plain; charset=utf-8' } }); - stream.on('error', err => { + stream.on('error', async err => { res.status(500).send(err.message); Sentry.captureException(err); if (transaction) transaction.finish(); + await Sentry.flush(5000); }); - stream.on('finish', () => { + stream.on('finish', async () => { res.status(200).send(encodeURIComponent(objectName)); if (transaction) transaction.finish(); + await Sentry.flush(5000); }); stream.end(JSON.stringify(report));