-
-
Notifications
You must be signed in to change notification settings - Fork 467
Description
Android FileObserver must handle envelope item types user feedback and attachments.
Currently, Attachments and User Feedback if written to the directory the Android filewatcher uses to capture events from other layers (like react-native, native, flutter), are not captured.
The relevant code is here:
sentry-java/sentry/src/main/java/io/sentry/OutboxSender.java
Lines 117 to 139 in f9f2686
| if (SentryItemType.Event.equals(item.getHeader().getType())) { | |
| try (final Reader eventReader = | |
| new BufferedReader( | |
| new InputStreamReader(new ByteArrayInputStream(item.getData()), UTF_8))) { | |
| SentryEvent event = serializer.deserialize(eventReader, SentryEvent.class); | |
| if (event == null) { | |
| logger.log( | |
| SentryLevel.ERROR, | |
| "Item %d of type %s returned null by the parser.", | |
| items, | |
| item.getHeader().getType()); | |
| } else { | |
| if (envelope.getHeader().getEventId() != null | |
| && !envelope.getHeader().getEventId().equals(event.getEventId())) { | |
| logger.log( | |
| SentryLevel.ERROR, | |
| "Item %d of has a different event id (%s) to the envelope header (%s)", | |
| items, | |
| envelope.getHeader().getEventId(), | |
| event.getEventId()); | |
| continue; | |
| } | |
| hub.captureEvent(event, hint); |
Ideally, this would be refactored to no longer call captureEvent. It's still there because through this method the event gets enriched with more context like device data, and scope data, if the event wasn't captured on a previous device run as the scope data would have been different. This is done through a Hint created by the FileObserver (only triggers during the app execution, which is a different code path of capturing cached errors on startup.