Repository navigation
ref(http): Retry Sentry API requests through @sentry/api 3's retry hook - #2542
Merged
Merged
Conversation
@sentry/api 3.0.0 replaces the transport's `retry` policy with a hook the transport calls once per request, after the cache lookup and the credential's `prepare`. toolkit-core now builds that hook on @sentry/http's `fetchWithRetry` as `sentryRetry`, and the CLI and MCP pass it to `createApiTransport` instead of wrapping `transport.request` with `withSentryRetry`. So a retried request looks up the cache and the credential once, not once per attempt. `TRANSPORT_SENDS_ONCE` goes away. The CLI's `isRetryableError` drops its `TimeoutError` case: an attempt now throws the transport's `ApiTimeoutError`, and `errors.timeout` maps it to `TimeoutError` once, after the hook gives up. The bump also types `event_id` as a string, so the MCP client's cast for 32-character event IDs is no longer needed. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
@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
approved these changes
Nov 26, 2026
BYK
marked this pull request as ready for review
November 26, 2026 22:23
This was referenced Nov 26, 2026
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.
Bumps
@sentry/apito 3.0.0 and moves the CLI and MCP retries onto the transport's newretryhook, added in getsentry/sentry#132687.What changes
withSentryRetryandTRANSPORT_SENDS_ONCEare replaced bysentryRetry(options): TransportRetry. It builds the hook on@sentry/http'sfetchWithRetry, usingSENTRY_RETRYABLE_STATUSESand@sentry/api'sparseRetryDelayMs.SentryRetryOptionstakespolicy,isRetryableError, and anonRetrythat also gets the retried request's method and URL.retry: sentryRetry({ policy })tocreateApiTransportinstead of wrappingtransport.request. The transport now runs the hook after the cache lookup and the credential'sprepare. 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.idempotentfrom the transport, which already combines the per-request flag with the operation catalog (isIdempotent). So the wrapper's separateisIdempotentoption goes away.isRetryableError: theTimeoutErrorcase is gone. An attempt now throws the transport'sApiTimeoutError, which isn't aCliError, so it still retries.errors.timeoutmaps the final timeout toTimeoutErroronce, after the hook gives up.event_idas 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 theminimumReleaseAgeExcludeentry 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/httpneeds no new export:fetchWithRetry(send, options)already fits the hook.via @BYK.
--
View Session [Sentry]