Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,25 @@ Your transport must honor the signal while a request is in flight. The SDK canno

Cancellation follows the [error handling contract](#error-handling): before dispatch the SDK uses `signal.reason`; during fetch it preserves the transport's rejection, which may differ by runtime. By default this is returned as `{ error, request, response: undefined }`, or thrown with `throwOnError: true`. Error interceptors can intentionally map it. Cancellation during response body reading rejects unchanged, even in fields mode. There is no SDK-specific cancellation error class.

### Uploading files to Objectstore

`@sentry/api/client` exports an Objectstore client for the service that upload-options endpoints such as `snapshots/upload-options/` return. `findExistingObjects` checks keys with batched HEAD requests; `putObjects` sends uploads up to 1 MB in batched multipart requests and PUTs larger ones individually. Batches hold up to 1000 operations and 25 MB, with up to 4 in flight, so large uploads stay under the per-request rate limit of the Sentry proxy. The client uses only web-standard APIs: the host supplies each file's bytes and may supply `fetch`.

```ts
import { findExistingObjects, putObjects } from "@sentry/api/client";

const existing = await findExistingObjects(objectstore, keys, { fetch });
await putObjects(
objectstore,
files
.filter((file) => !existing.has(file.key))
.map((file) => ({ key: file.key, size: file.size, read: () => readFile(file.path) })),
{ fetch },
);
```

Failures throw `ObjectstoreError`, an `ApiError` with the failing object or request `url`.

## Runtime validation

The root `@sentry/api` entry has no runtime dependencies. It provides the API client and pure TypeScript types without installing a validation library.
Expand Down
2 changes: 1 addition & 1 deletion build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ await Promise.all([
bundle("zod", { external: ["zod"] }),
bundle("browser"),
// Keep the package entries external so consumers share the root error classes.
bundle("api-client/index", { external: ["@sentry/api", "http-cache-semantics"] }),
bundle("api-client/index", { external: ["@sentry/api", "http-cache-semantics", "p-limit"] }),
bundle("api-client/endpoints/index", { external: ["@sentry/api", "@sentry/api/client"] }),
bundle("operations"),
bundle("source-analysis", { external: ["typescript"], platform: "node" }),
Expand Down
1 change: 1 addition & 0 deletions lib/api-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export * from "./auth-token.js";
export * from "./core.js";
export * from "./errors.js";
export * from "./idempotent-operations.js";
export * from "./objectstore.js";
export * from "./pagination.js";
export * from "./response.js";
export * from "./response-cache/index.js";
Expand Down
Loading
Loading