Context Not Being Sent with Raven Node

Hey,

In the Raven SDK for NodeJS, we can set and log the context, but the context is not sent to Sentry. We have experimented with setting user context as well, but it also is not sent to Sentry. In contrast, captured exceptions are successfully sent. Code below.

How do you suggest fixing the issue?

Many thanks,
Tom

app.use((req, res, next) => {
    Raven.context(() => {
        const ActiveAccountProfileId = req.jwt ? req.jwt.active_account_profile_id : 'Fake Account Profile ID'
        const AgentProfileId = req.jwt ? req.jwt.agent_profile_id : 'Fake Agent Profile ID'
        Raven.mergeContext({
            tags: {
                email: 'Fake email',
                ActiveAccountProfileId,
                AgentProfileId,
            },
        })
        console.log(Raven.getContext())
        next()
    })
})


// logged in the console
 { tags:
{ email: 'Fake email',
   ActiveAccountProfileId: 'Fake Account Profile ID',
   AgentProfileId: 'Fake Agent Profile ID' },
  breadcrumbs:
  [ { timestamp: 1529959820.062,
     message: '{ tags: \n   { email: \'Fake email\',\n     ActiveAccountProfileId: \'Fake Account Profile ID\',\n     AgentProfileId: \'Fake Agent Profile ID\' } }',
     level: 'log',
    category: 'console' } ] }
1 Like