Skip to content

feat(tus): add Upload-Metadata header to TUS requests#1795

Merged
JoshuaMoelans merged 2 commits into
masterfrom
jpnurmi/feat/tus/attachment-type
Jun 5, 2026
Merged

feat(tus): add Upload-Metadata header to TUS requests#1795
JoshuaMoelans merged 2 commits into
masterfrom
jpnurmi/feat/tus/attachment-type

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Add metadata header to TUS creation (POST) and upload (PATCH) requests:

Upload-Metadata: `sentry <base64({"attachment_type":"<type>"})>

Testing:

> PATCH /api/4506178389999616/upload/019e96908b507902972f06b45a439cda/?length=1000000000&signature=YXFNYnv3TBKLaRby0uo7GFuuundlJ-9TdcGNiyEeGkb8ufFPZkio3s7NR_0qZHYNt14hYQN568cwwQsApTfKAQ.eyJ0IjoiMjAyNi0wNi0wNVQwNjo1NToxNS43OTIwNzMwMzVaIn0 HTTP/2
Host: o447951.ingest.us.sentry.io
User-Agent: sentry.native/0.14.2
Accept: */*
x-sentry-auth:Sentry sentry_key=d545f4da00ff7b2fa7b6c8620c94a4e9, sentry_version=7, sentry_client=sentry.native/0.14.2
tus-resumable:1.0.0
content-type:application/offset+octet-stream
upload-offset:0
upload-metadata:sentry eyJhdHRhY2htZW50X3R5cGUiOiJldmVudC5hdHRhY2htZW50In0=
Content-Length: 1000000000

* upload completely sent off: 1000000000 bytes
$ base64 -d <<<"eyJhdHRhY2htZW50X3R5cGUiOiJldmVudC5hdHRhY2htZW50In0="
{"attachment_type":"event.attachment"}

https://sentry-sdks.sentry.io/issues/7528989067

See also:

Add the `Upload-Metadata` header to TUS creation (POST) and upload
(PATCH) requests in the `sentry <base64({"attachment_type":"<type>"})>`
format that the relay server expects for preliminary quota checks.
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 2d21a1f

@JoshuaMoelans JoshuaMoelans merged commit 065d610 into master Jun 5, 2026
65 checks passed
@JoshuaMoelans JoshuaMoelans deleted the jpnurmi/feat/tus/attachment-type branch June 5, 2026 13:20
JoshuaMoelans added a commit to getsentry/sentry that referenced this pull request Jul 1, 2026
…16963)

We offer previews of attachments, but for large files these can slow
down or even freeze a page (see below). Since we are introducing large
file attachments (e.g., this [sentry-native
PR](getsentry/sentry-native#1795)), trying to
preview files up to 1GiB seems too ambitious for a browser window.

We could do the same thing we do for certain attachment types (like
minidumps, binary files, ...) and disable the preview button as such:
<img width="1073" height="188" alt="Screenshot 2026-06-05 at 11 57 48"
src="https://github.com/user-attachments/assets/9bdec060-0388-4a68-a5e1-50de363b4c18"
/>

TBD: currently set the `MAX_TEXT_PREVIEW_SIZE` to 20MiB, not sure if
this is an appropriate value? Currently it is based on the recommended
`max_attachment_size` set in some SDKs (defaults to 20MiB), and text
fields of this size and below render decently fast (~3s).

---

For example, from [a 199MiB
attachment](https://sentry-sdks.sentry.io/issues/7529263714/events/1e2089d5f58146eb82ecb78a2930baf8/?project=4509371203256320):

<img width="673" height="261" alt="Screenshot 2026-06-05 at 13 53 02"
src="https://github.com/user-attachments/assets/f6f3af72-0740-40bb-a88b-12c22fc03b0e"
/>


[Link to events with different sized
attachments](https://sentry-sdks.sentry.io/issues/7529263714/events/ef22d84b6981437181572e3d23ed74c6/events/?project=4509371203256320)
(20-199MiB)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants