meteor3: raven -> @sentry/node + @sentry/browser

flowkey:raven (Sentry legacy SDK) is dead on Meteor 3 and, with the old
sentry.comunes.org DSN unreachable, spammed the boot log with 502s on every
exception. Replaced by the modern SDKs (8.x) behind the same ravenLogger.log()
facade so the 6 call sites are unchanged. Empty DSN -> plain console logger
(same behavior as before).

End-to-end verified against a real backend: GlitchTip deployed on aaron
(Sentry-compatible, fits in ~1.5GB vs Sentry's 16GB), fronted at
sentry.comunes.org. A test exception sent from the dev server appeared in
GlitchTip within seconds. REST smoke byte-identical (12/12).
This commit is contained in:
vjrj 2026-07-16 12:20:02 +02:00
parent 197a59f641
commit 4ca7e198d3
7 changed files with 1184 additions and 96 deletions

View file

@ -1,18 +1,35 @@
import RavenLogger from 'meteor/flowkey:raven';
/* eslint-disable import/no-absolute-path */
// Error reporter (server). Was flowkey:raven (raven@2.4.1, Sentry legacy SDK),
// which is dead on Meteor 3 and, with a dead DSN, spammed the boot log with
// "failed to send exception to sentry: HTTP Error (502)". Replaced by the
// modern @sentry/node SDK behind the same `.log()` facade so the 6 call sites
// don't change. With no DSN configured it is a pure console logger (identical
// to the old "disabled" branch) — ready to point at a DSN when Sentry/GlitchTip
// is back, via Meteor.settings.sentryPrivateDSN.
import * as Sentry from '@sentry/node';
import { Meteor } from 'meteor/meteor';
const ravenOptions = {};
const publicDSN = Meteor.settings.public.sentryPublicDSN;
const privateDSN = Meteor.settings.sentryPrivateDSN;
const enabled = publicDSN && privateDSN;
const dsn = Meteor.settings.sentryPrivateDSN;
const enabled = !!dsn;
const ravenLogger = enabled ? new RavenLogger({
publicDSN,
privateDSN,
shouldCatchConsoleError: true, // default true
trackUser: true // default false
}, ravenOptions) : { log: (error) => { console.log(error); } };
if (enabled) {
Sentry.init({
dsn,
environment: Meteor.isDevelopment ? 'development' : 'production',
// errors only; no tracing/profiling (avoids the OTel auto-instrumentation)
tracesSampleRate: 0
});
}
console.log(`ravenLogger ${enabled ? 'enabled' : 'disabled'}`);
const ravenLogger = {
log(error, extra) {
console.error(error);
if (enabled) {
Sentry.captureException(error, extra ? { extra: { info: extra } } : undefined);
}
}
};
console.log(`sentryLogger (server) ${enabled ? 'enabled' : 'disabled'}`);
export default ravenLogger;