Skip to content

ref(api): Read and write Objectstore batches with FormData - #131779

Merged
BYK merged 1 commit into
masterfrom
byk/feat/api-objectstore-formdata
Nov 20, 2026
Merged

BYK merged 1 commit into
masterfrom
byk/feat/api-objectstore-formdata

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

The @sentry/api Objectstore client (used by the Sentry CLI's snapshots upload) had its own byte-level multipart encoder and parser for the batch endpoint, because all per-operation data travelled in custom part headers that FormData drops. Objectstore now has a JSON layout for batches that carries that data in form fields instead (getsentry/objectstore#769, getsentry/objectstore#804, thanks @jan-auer). This switches the client to it:

  • Requests are a FormData: each operation is a JSON descriptor field named by its index ({"kind":"head","key":"…"}), and each insert also gets a "<i>.payload" file holding the bytes. The expiration policy moves from the x-sn-expiration part header to metadata.expiration. fetch sets the multipart Content-Type and boundary.
  • Responses are read with Response.formData(). Each result is a JSON field named by its operation index ({"status":404,…}, with error.detail on failure). Fields that aren't results, such as GET payloads, are skipped. A multipart response that can't be parsed throws an ObjectstoreError (502), the same as a response that isn't multipart.
  • Keys go into JSON unescaped. encodeHeaderValue, the boundary regex, and the byte-scanning helpers are removed.

The public API (findExistingObjects, putObjects, ObjectstoreError) doesn't change. Single-object PUTs for files over 1 MB don't change either. All part names are quoted, so Node 22's Response.formData() (undici before 7.17) can parse responses too.

Open question before merge: the client no longer speaks the header layout, so it needs an Objectstore server that has getsentry/objectstore#804. A server without it would fail every batch operation. Please confirm that the production Objectstore behind the Sentry proxy runs a build with #804 before this ships in an @sentry/api release.

via @BYK.

--

View Session [Sentry]

Objectstore's batch endpoint now has a JSON layout that carries all
operation data in form fields (getsentry/objectstore#804). Build batch
requests with FormData and read results with Response.formData(),
replacing the hand-rolled multipart encoder and parser.

Refs getsentry/objectstore#769

Co-Authored-By: BYK <[email protected]>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 19, 2026
@BYK
BYK marked this pull request as ready for review November 20, 2026 20:03
@BYK
BYK requested review from a team as code owners November 20, 2026 20:03
@sentry-junior
sentry-junior Bot requested a review from BYK November 20, 2026 20:03

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! I also got a note here from the authors:

We’re also disabling compression now for PNGs because it doesn’t make sense

And ref: getsentry/sentry-cli#3504

@BYK
BYK merged commit f6cef76 into master Nov 20, 2026
81 checks passed
@BYK
BYK deleted the byk/feat/api-objectstore-formdata branch November 20, 2026 20:04

This branch was successfully deployed

1 active deployment
Preview — fb733963 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant