sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Add Attachment support

Open bruno-garcia opened this issue 4 years ago • 11 comments

The native SDKs (sentry-android, sentry-cocoa) added support to Attachments.

The spec is in the develop docs.

Thumbs up if this is the feature you've been waiting for.

bruno-garcia avatar Feb 02 '21 18:02 bruno-garcia

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Nov 04 '21 15:11 github-actions[bot]

In addition to this, it would be awesome to be able to run a callback when an error happen and generate attachments from this callback.

I have multiple states in the app (Redux, async storage…) and I would like to dump them in attachments when an issue occurs in the app to be able to understand the error if it comes from a bad state. Currently I could add them to the event, but it can quickly go over the 200kb limit.

renchap avatar Dec 20 '21 17:12 renchap

This is blocked by https://github.com/getsentry/sentry-javascript/issues/4240

The RN SDK uses the JS SDK for building an event and the current version does not support the Envelope feature which is required for sending attachments.

To make it work we'd need to override many of the JS behavior and later replace them once the Envelope feature is landed on the linked PR natively on the JS SDK.

The best is to postpone and implement once #4240 is done, also considering attaching attachments to hard crashes on the Native layer.

Points to consider:

  • Use the envelope feature from #4240
  • Attach attachments on hard crashes, that requires changes on Sentry-Android, Sentry-Native, and Sentry-Cocoa since we don't sync down the attachments to the Native layers (e.g. KSCrash and Sentry-Native)
  • We could technically support an array of bytes and file paths since RN does not support files natively, people most of the time use 3rd party plugins to do so.

marandaneto avatar Jan 13 '22 17:01 marandaneto

We got hit by lack of support for this feature and the addGlobalEventProcessor approach that's documented for the javascript SDK was not working for us. We'd see 201 Accepted requests for the attachment on the server but they did not get attached to the event. Ultimately we ended up writing a bridge module and using the sentry-cocoa and sentry-android native APIs to send events with attachments for the limited case where we needed an attachment. Would really love support for attachments to get added to sentry-react-native using the scope.addAttachment features available in the native sdks.

mmerickel avatar Jan 21 '22 21:01 mmerickel

Same @mmerickel I would see 201 but no attachment on Sentry. We left it for now, that was awesome you did the bridge.

Noitidart avatar Jan 21 '22 23:01 Noitidart

We got hit by lack of support for this feature and the addGlobalEventProcessor approach that's documented for the javascript SDK was not working for us. We'd see 201 Accepted requests for the attachment on the server but they did not get attached to the event. Ultimately we ended up writing a bridge module and using the sentry-cocoa and sentry-android native APIs to send events with attachments for the limited case where we needed an attachment. Would really love support for attachments to get added to sentry-react-native using the scope.addAttachment features available in the native sdks.

mmerickel Would you consider making the source for this bridge module publicly available? I'm trying to do the same and hit some roadblocks with regards to bridging functionality.

hdsenevi avatar May 03 '22 02:05 hdsenevi

#4240 is done, and sentry-react-native 4.0.0 uses it 👀

renchap avatar Jun 11 '22 17:06 renchap

And 4.0.0 is released, maybe you can remove the "blocked" tag? ;)

renchap avatar Jun 22 '22 12:06 renchap

@renchap is attachment support in 4.0.0? or 4.0.0 just makes attachment support possible?

Noitidart avatar Jun 22 '22 15:06 Noitidart

It should make it possible, but not implemented yet.

renchap avatar Jun 22 '22 15:06 renchap

JS 7.0 unblocked this and it's a p1 for us. Btw we're hiring a RN engineer if anyone wants to get paid to work on open source full time: https://sentry.io/careers/3642918/

bruno-garcia avatar Jun 23 '22 00:06 bruno-garcia

https://github.com/getsentry/sentry-react-native/pull/2463

marandaneto avatar Sep 15 '22 14:09 marandaneto