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

@ -35,7 +35,6 @@ alexwine:bootstrap-4
gadicc:blaze-react-component # Add braze to react
255kb:meteor-status # Connect status
# mixmax:smart-disconnect # Disconnect on lost focus (disabled to get notif)
flowkey:raven # js errors
vjrj:piwik # Stats
mdg:geolocation
tcef:publish-performant-counts

View file

@ -42,7 +42,6 @@ es5-shim@4.8.1
facebook-oauth@1.11.4
facts-base@1.0.2
fetch@0.1.5
flowkey:raven@1.1.0
fortawesome:fontawesome@4.7.0
fourseven:scss@5.0.0
gadicc:blaze-react-component@2.0.1

View file

@ -304,7 +304,7 @@ MONGO_CONTAINER=tcef-mongo7 MONGO_SHELL=mongosh MONGO_PORT=27019 ./smoke/smoke.s
| React / react-dom | 16.0 | 18 | ✅ done — 18.3.1 + createRoot; ancient react-* libs work on 18 via legacy context (die on 19, debt). |
| Server async/await | Fibers | `*Async` APIs | ✅ done — REST, publications, methods, startup and migrations all on `*Async`. |
| bcrypt | 1.0.3 (broken binding) | 5.x | ✅ done — 1.0.3 didn't load on Node 22 (accounts-password silently fell back to pure JS) and wouldn't compile in the Docker build; 5.1.1 ships Node-22 prebuilds. |
| raven / flowkey:raven | 2.4 | @sentry/node + @sentry/react | debt — DSN off until GlitchTip/Sentry back (sentry.comunes.org dead → harmless boot-log timeout noise) |
| raven / flowkey:raven | 2.4 | @sentry/node + @sentry/browser 8.x | ✅ done — `flowkey:raven` (Sentry legacy SDK, dead on 3.x, spammed the boot log with 502s against the dead sentry.comunes.org) replaced by the modern SDKs behind the same `ravenLogger.log()` facade (6 call sites unchanged). Backend: **GlitchTip** self-hosted on `aaron` (Sentry-compatible DSN/API; Sentry proper needs 16 GB RAM, didn't fit), deployed via the Comunes ansible (`glitchtip.yml`, org "comunes" / project "tcef-web"), fronted at `https://sentry.comunes.org` (nginx on `assange``aaron:8000`). DSN set in `settings-development.json`; end-to-end verified (a test exception sent from the dev server showed up in GlitchTip within seconds). |
| nodemailer | 4 | 6+ | pending |
| Babel | 7 beta | 7 stable | ✅ done (escala 1) |
| i18next | 10 | current | debt — pin; not on the critical path |

View file

@ -1,16 +1,31 @@
import RavenLogger from 'meteor/flowkey:raven';
// Error reporter (client). Was flowkey:raven; replaced by @sentry/browser
// behind the same `.log()` facade (see the server counterpart). Enabled only
// when Meteor.settings.public.sentryPublicDSN is set; otherwise a plain console
// logger. ErrorBoundary calls `.log(error, info)` where info is React's
// { componentStack } — passed to Sentry as extra context.
import * as Sentry from '@sentry/browser';
import { Meteor } from 'meteor/meteor';
const ravenOptions = {};
const publicDSN = Meteor.settings.public.sentryPublicDSN;
const enabled = !!publicDSN;
const dsn = Meteor.settings.public.sentryPublicDSN;
const enabled = !!dsn;
const ravenLogger = enabled ? new RavenLogger({
publicDSN, // will be used on the client
shouldCatchConsoleError: true, // default
trackUser: true // default
}, ravenOptions) : { log: (error) => { console.log(error); } };
if (enabled) {
Sentry.init({
dsn,
environment: Meteor.isDevelopment ? 'development' : 'production',
tracesSampleRate: 0
});
}
console.log(`ravenLogger ${enabled ? 'enabled' : 'disabled'}`);
const ravenLogger = {
log(error, info) {
console.log(error);
if (enabled) {
Sentry.captureException(error, info ? { extra: { info } } : undefined);
}
}
};
console.log(`sentryLogger (client) ${enabled ? 'enabled' : 'disabled'}`);
export default ravenLogger;

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;

1198
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,8 @@
"dependencies": {
"@babel/runtime": "^7.29.7",
"@cleverbeagle/dates": "^0.5.1",
"@sentry/browser": "^8.55.2",
"@sentry/node": "^8.55.2",
"@turf/buffer": "^5.1.5",
"babel-runtime": "^6.26.0",
"bcrypt": "^5.1.1",