Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context not being sent #937

Closed
5 of 11 tasks
alex-trofimov opened this issue Jun 16, 2020 · 8 comments
Closed
5 of 11 tasks

Context not being sent #937

alex-trofimov opened this issue Jun 16, 2020 · 8 comments

Comments

@alex-trofimov
Copy link

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS (haven't checked)
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 1.4.0

react-native version: 0.61.5

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

https://sentry.io/organizations/captainai/issues/1727248936/

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'superSecretDSNKey'
});
Sentry.setContext('context1', {key1: 'value2'});

Sentry.configureScope(scope => {
    scope.setContext('context2', {key2: 'value2'});
    scope.setExtra('extra', {key3: 'value3'});
});

[some exception triggering code]

I have following issue:

I'm trying to add some custom context to the report. And it's being added to the event object, this can be checked by adding logging to beforeSend hook:

image

However, the actual context is missing both on the issue page and in the issue json file. The extras, user info, tags, etc are being correctly added.

Actual result:

Issues missing custom context

Expected result:

Issues have custom context

@jennmueng
Copy link
Member

Hi, can you paste a link to the raw json, maybe to somewhere like pastebin? We can't access the link to the issue as we don't have access to your organization.

Thanks!

@alex-trofimov
Copy link
Author

Hey @jennmueng
Do you mind if I send you the data via email? I want to avoid posting this project's debug data on public forums

@jennmueng
Copy link
Member

@Legi0n1138 Yes sure, I completely understand. You can send it to jenn@sentry.io

@alex-trofimov
Copy link
Author

@jennmueng thank you for understanding! Data sent ✔️

@jennmueng
Copy link
Member

@Legi0n1138 Thanks for the data, I looked into it and found out that on Android we don't support custom keys yet. In the meantime, if you update to the latest version we have a workaround where the context are passed as extras instead so at least you get the information, just not formatted as nicely.

@alex-trofimov
Copy link
Author

Hey, @jennmueng thank you for the response. Updated to 1.4.5 but for some reason don't see any difference in behavior.
Maybe you could show me a working example?
Also, is it possible to set the context in beforeSend on android?

Another thing is: SDK version in JSON output is "1.4.1" (and it was the same way when we were on 1.4.0)

@jennmueng
Copy link
Member

@Legi0n1138 Hmm as the SDK is showing the wrong version on the JSON output, have you made sure that the SDK on Android was linked and installed correctly? Otherwise, you can look at the sample app the this repo, all the scope/contexts in there have been confirmed working.

And yes, you can set the context in the beforeSend. You can edit the event passed to the beforeSend callback in any way you like and return it.

@marandaneto
Copy link
Contributor

@jennmueng this has been fixed, right? should we close it?
https://github.com/getsentry/sentry-react-native/releases/tag/1.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants