Skip to content

Capture User Feedback and Attachment from other layers (native, flutter, react-native) #1103

@bruno-garcia

Description

@bruno-garcia

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions