Repository navigation
ref(api): Read and write Objectstore batches with FormData - #131779
Merged
Merged
Conversation
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 <126780+BYK@users.noreply.github.com>
BYK
marked this pull request as ready for review
November 20, 2026 20:03
BYK
approved these changes
Nov 20, 2026
BYK
left a comment
Member
There was a problem hiding this comment.
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
2 tasks done
sentry-junior Bot
added a commit
to getsentry/toolkit
that referenced
this pull request
Nov 26, 2026
@sentry/api 3.0.0 includes getsentry/sentry#131779, which sends and reads Objectstore batches as FormData: one JSON part per operation, named by its index, with an insert's bytes in `<index>.payload`. The CLI's objectstore tests still built responses with the old `x-sn-batch-operation-*` part headers, which the new parser rejects.
BYK
added a commit
to getsentry/toolkit
that referenced
this pull request
Nov 26, 2026
…ok (#2542) Bumps `@sentry/api` to 3.0.0 and moves the CLI and MCP retries onto the transport's new `retry` hook, added in getsentry/sentry#132687. ### What changes - **toolkit-core:** `withSentryRetry` and `TRANSPORT_SENDS_ONCE` are replaced by `sentryRetry(options): TransportRetry`. It builds the hook on `@sentry/http`'s `fetchWithRetry`, using `SENTRY_RETRYABLE_STATUSES` and `@sentry/api`'s `parseRetryDelayMs`. `SentryRetryOptions` takes `policy`, `isRetryableError`, and an `onRetry` that also gets the retried request's method and URL. - **CLI and MCP:** both pass `retry: sentryRetry({ policy })` to `createApiTransport` instead of wrapping `transport.request`. The transport now runs the hook after the cache lookup and the credential's `prepare`. A retried request looks up the cache and the credential once, and it gets one host span instead of one per attempt. Each attempt still has its own timeout, body buffering, redirect checks, and 401 refresh, and the refresh doesn't count as a retry. - **Idempotency:** the hook gets `idempotent` from the transport, which already combines the per-request flag with the operation catalog (`isIdempotent`). So the wrapper's separate `isIdempotent` option goes away. - **CLI `isRetryableError`:** the `TimeoutError` case is gone. An attempt now throws the transport's `ApiTimeoutError`, which isn't a `CliError`, so it still retries. `errors.timeout` maps the final timeout to `TimeoutError` once, after the hook gives up. - **MCP issue-event read:** 3.0.0 types `event_id` as a string, so the cast for 32-character event IDs is removed. Without it, lint fails with an unnecessary-assertion error. - **`pnpm-workspace.yaml`:** the catalog entry and the `minimumReleaseAgeExclude` entry move to `@sentry/api@3.0.0`. ### Also picked up from 2.16.0 The bump from 2.15.0 includes getsentry/sentry#131779, which sends and reads Objectstore batches as FormData. Each operation is a JSON part named by its index, and an insert's bytes go in `<index>.payload`. The CLI's snapshot uploads use that batch client, so their wire format changes with this PR. The CLI's objectstore test fixtures now build responses in that format. `@sentry/http` needs no new export: `fetchWithRetry(send, options)` already fits the hook. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A672bf07a67118adf395d2ead4a7cd9aa --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A672bf07a67118adf395d2ead4a7cd9aa) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A672bf07a67118adf395d2ead4a7cd9aa/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <126780+BYK@users.noreply.github.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
@sentry/apiObjectstore client (used by the Sentry CLI'ssnapshots upload) had its own byte-level multipart encoder and parser for the batch endpoint, because all per-operation data travelled in custom part headers thatFormDatadrops. 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: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 thex-sn-expirationpart header tometadata.expiration.fetchsets the multipartContent-Typeand boundary.Response.formData(). Each result is a JSON field named by its operation index ({"status":404,…}, witherror.detailon failure). Fields that aren't results, such as GET payloads, are skipped. A multipart response that can't be parsed throws anObjectstoreError(502), the same as a response that isn't multipart.encodeHeaderValue, the boundary regex, and the byte-scanning helpers are removed.The public API (
findExistingObjects,putObjects,ObjectstoreError) doesn't change. Single-objectPUTs for files over 1 MB don't change either. All part names are quoted, so Node 22'sResponse.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/apirelease.via @BYK.
--
View Session [Sentry]