With the upcoming update you can have in your custom route next to exports.handler
an exports.before
and exports.after
where the before is like the handler and comes before the generated routes and the after comes after all the routes are generated.
So code would become like:
const Sentry = require('@sentry/node');
exports.before = function(app) {
Sentry.init({ dsn: "CHANGE_ME" });
app.use(Sentry.Handlers.requestHandler());
};
exports.after = function(app) {
app.use(Sentry.Handlers.errorHandler());
};
Save this to extensions/server_connect/routes/sentry.js
.