diff --git a/app/util/sentry/utils.js b/app/util/sentry/utils.js index ffcc573e8a8..78d0c48465c 100644 --- a/app/util/sentry/utils.js +++ b/app/util/sentry/utils.js @@ -83,8 +83,25 @@ function removeDeviceName(report) { report.contexts.device.name = null; } +/** + * Removes SES from the Sentry error event stack trace. + * By default, SES is shown as the top level frame, which can obscure errors. + * We filter it out by identifying the SES stack trace frame simply by 'filename', + * since the 'context_line' is rather verbose. + * @param {*} report - the error event + */ +function removeSES(report) { + const stacktraceFrames = report.exception.values[0].stacktrace.frames; + const filteredFrames = stacktraceFrames.filter( + (frame) => frame.filename !== 'app:///ses.cjs', + ); + report.exception.values[0].stacktrace.frames = filteredFrames; +} + function rewriteReport(report) { try { + // filter out SES from error stack trace + removeSES(report); // simplify certain complex error messages (e.g. Ethjs) simplifyErrorMessages(report); // remove urls from error message