-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
setting the scope for Sentry.captureException clearing out user data, I need to merge user data with tag and context, New to sentry and trying things around, I don't understand is this a bug or this how sentry work but I go thought the doc they say Use Scope instance to pass the data (its attributes will still merge with the global scope): < link
I get the header authorization from the client and I decode and set the user Id to Sentry like below
authUser.js
function authUser(authorization) {
return new Promise((resolve, reject) => {
const cognito = new AWS.CognitoIdentityServiceProvider();
cognito.getUser(
{
AccessToken: authorization,
},
function (error, result) {
if (error) reject(error);
else {
Sentry.setUser({ id: result.Username });
resolve(result);
}
}
);
});
}And I import the authUser.js on resolvers and use there. And when an error occurred I handle like below, This ignores user data
const scope = new Sentry.Scope();
scope.setTag("resolver", "QueryMe");
scope.setContext("header", headers);
const code = Sentry.captureException(error, scope);
return new ApolloError("serverErrorExpectation", code);But removing the scope from Sentry.captureException shows the user data on the dashboard.
Package + Version
"@sentry/node": "^5.27.0",
"@sentry/tracing": "^5.27.0",
Metadata
Metadata
Assignees
Labels
No labels