---
title: "Bindings"
description: "Learn which Cloudflare bindings Sentry instruments automatically and what each binding captures."
url: https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/bindings/
---

# Cloudflare Bindings | Sentry for Cloudflare

The Sentry Cloudflare SDK instruments the bindings on your `env` object automatically. You don't have to wrap a binding or call a function. When your code reads a binding from `env`, the SDK detects its type and returns an instrumented version.

## [Supported Bindings](https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/bindings.md#supported-bindings)

| Binding                                                                                               | What Sentry captures                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [D1](https://developers.cloudflare.com/d1/)                                                           | Database queries                                                                                                                                                      |
| [R2](https://developers.cloudflare.com/r2/)                                                           | Bucket operations, such as reads and uploads                                                                                                                          |
| [Queues](https://developers.cloudflare.com/queues/)                                                   | Messages that you send to a queue                                                                                                                                     |
| [Workers AI](https://developers.cloudflare.com/workers-ai/)                                           | Model calls, see [Workers AI](https://docs.sentry.io/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.md)                                              |
| [Durable Objects](https://developers.cloudflare.com/durable-objects/)                                 | Traces that continue in the Durable Object, see [Cloudflare Durable Objects](https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/durableobject.md) |
| [Service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/) | Traces that continue in the other Worker, if it also uses Sentry                                                                                                      |

For RPC calls to Durable Objects and service bindings, add the binding to [`rpcTracePropagationBindings`](https://docs.sentry.io/platforms/javascript/guides/cloudflare/tracing/distributed-tracing.md#rpc-trace-propagation).

## [Which `env` Is Instrumented](https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/bindings.md#which-env-is-instrumented)

The SDK instruments the `env` object that Cloudflare gives to the handlers and classes that Sentry wraps, such as your Worker, Durable Objects, and Workflows.

The global `env` that you import from `cloudflare:workers` is not instrumented. Bindings that you read from it don't create spans. Use the `env` argument of your handler or class instead:

```javascript
import * as Sentry from "@sentry/cloudflare";
import { env as globalEnv } from "cloudflare:workers";

export default Sentry.withSentry(
  (env) => ({ dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>", tracesSampleRate: 1.0 }),
  {
    async fetch(request, env) {
      // Creates a span: `env` is the handler argument
      await env.DB.prepare("SELECT * FROM users").all();

      // Does not create a span: `globalEnv` is the global env
      await globalEnv.DB.prepare("SELECT * FROM users").all();

      return new Response("OK");
    },
  },
);
```
