Skip to content

fix: Include screenshot attachment in native backend envelope#1624

Merged
tustanivsky merged 6 commits intomasterfrom
fix/native-backend-screenshot-attachment
Apr 2, 2026
Merged

fix: Include screenshot attachment in native backend envelope#1624
tustanivsky merged 6 commits intomasterfrom
fix/native-backend-screenshot-attachment

Conversation

@tustanivsky
Copy link
Copy Markdown
Collaborator

Summary

The native backend's crash daemon captures screenshot out-of-process via sentry__screenshot_capture() and saves it to {run_folder}/screenshot.png. However, neither write_envelope_with_native_stacktrace nor write_envelope_with_minidump included this file in the envelope. After the envelope was sent, the run folder was cleaned up deleting the screenshot that was never transmitted.

The crashpad and breakpad backends handle this correctly: crashpad passes the screenshot path to StartHandler() and breakpad explicitly calls sentry__envelope_add_attachment().

Suggested fix

Both envelope writing functions now check for screenshot.png in the run folder and add it via the existing
write_attachment_to_envelope() helper which gracefully skips missing files. This follows the same pattern used for scope attachments read from the __sentry-attachments metadata file.

Related items

@tustanivsky tustanivsky requested review from jpnurmi and mujacica April 2, 2026 12:31
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@jpnurmi
Copy link
Copy Markdown
Collaborator

jpnurmi commented Apr 2, 2026

does this fix the screenshot test for native? are we able to remove the skip?

pytest.param(
{"SENTRY_BACKEND": "native"},
marks=pytest.mark.skip(
reason="Native backend screenshot needs testing on Windows machine"
),
),

@tustanivsky
Copy link
Copy Markdown
Collaborator Author

does this fix the screenshot test for native? are we able to remove the skip?

The file-existence test still has to be skipped for native backend since the daemon deletes the run folder after processing the envelope. So basically by the time we check for the file it's already gone.

@tustanivsky tustanivsky merged commit c355e21 into master Apr 2, 2026
53 checks passed
@tustanivsky tustanivsky deleted the fix/native-backend-screenshot-attachment branch April 2, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants