mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Fix "cannot read property id of null" in staging
This commit is contained in:
parent
b82743463e
commit
123c30b301
@ -14,13 +14,16 @@ if (sentryConfigs.SENTRY_DSN_BACKEND) {
|
||||
},
|
||||
withScope: (scope, error, context) => {
|
||||
scope.setUser({
|
||||
id: context.user.id,
|
||||
id: context.user && context.user.id,
|
||||
})
|
||||
scope.setExtra('body', context.req.body)
|
||||
scope.setExtra('origin', context.req.headers.origin)
|
||||
scope.setExtra('user-agent', context.req.headers['user-agent'])
|
||||
},
|
||||
})
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
if (process.env.NODE_ENV !== 'test') console.log('Warning: Sentry middleware inactive.')
|
||||
}
|
||||
|
||||
export default sentryMiddleware
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user