Skip to main content
The Transport is responsible for sending events to Sentry. It handles buffering, rate limiting, and error handling.

Overview

Transports:
  • Send envelopes containing events to Sentry
  • Buffer requests to prevent overwhelming the system
  • Handle rate limiting from the Sentry backend
  • Support graceful shutdown with flushing

Interface Definition

Methods

send

Send an envelope to Sentry.
Envelope
required
The envelope containing events to send.
Returns: Promise resolving to a response object.
number
HTTP status code of the response.
object
Response headers including rate limit information.
string | null
Rate limit information from Sentry.
string | null
Time to wait before retrying.

flush

Wait for all pending requests to complete.
number
Maximum time in milliseconds to wait. If not provided, waits indefinitely.
Returns: Promise resolving to true if all requests completed, false if timeout was reached.

Creating a Transport

Use the createTransport helper to create a transport:
InternalBaseTransportOptions
required
Transport configuration options.
string
required
The Sentry ingestion endpoint URL.
Record<string, string>
Custom HTTP headers to include in requests.
number
Maximum number of requests to buffer. Defaults to 64.
string
Tunnel URL for proxying requests.
function
required
Callback to record dropped events for client reports.
TransportRequestExecutor
required
Function that executes the actual HTTP request.
PromiseBuffer
Optional custom promise buffer for request queuing.

Transport Request

string | Uint8Array
required
The serialized envelope to send.

Example: HTTP Transport

Example: Custom Transport

Rate Limiting

The transport automatically handles rate limiting:

Buffer Management

Transports use a promise buffer to limit concurrent requests:

Error Handling

Transports handle various error scenarios: 413 Content Too Large:
Network Errors: