I am using sentry with node and express. I’m unable to get the user to attach to my scope. My code looks like this:
app.use(Sentry.Handlers.requestHandler());
app.use((req, res, next) => {
console.log('the user', req.user);
if (!isEmpty(req.user)) {
Sentry.configureScope(scope => {
scope.setUser({ email: req.user.email });
});
}
next();
});
app.use(Sentry.Handlers.errorHandler());
The console log does in fact print out a user but when my exceptions roll in, there is no user attached, just the default ip. Any idea what I’m doing wrong?