Add Attachment support
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.
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 🥀
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.
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.
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.
Same @mmerickel I would see 201 but no attachment on Sentry. We left it for now, that was awesome you did the bridge.
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.addAttachmentfeatures 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.
#4240 is done, and sentry-react-native 4.0.0 uses it 👀
And 4.0.0 is released, maybe you can remove the "blocked" tag? ;)
@renchap is attachment support in 4.0.0? or 4.0.0 just makes attachment support possible?
It should make it possible, but not implemented yet.
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/
https://github.com/getsentry/sentry-react-native/pull/2463