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:
parent
197a59f641
commit
4ca7e198d3
7 changed files with 1184 additions and 96 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue