Sentry for Cloudflare Workers

Using Sentry with Cloudflare Workers makes debugging as painless as possible, so you can keep everything up and running.

Getting Started is Simple

Add @sentry/cloudflare as a dependency:

Click to Copy
npm install --save @sentry/cloudflare

Configure the nodejs_compat compatibility flag in your wrangler.json:

Click to Copy
{ "compatibility_flags": [ "nodejs_compat" ], "compatibility_date": "2026-02-06" }

Then wrap your handler with the withSentry function:

Click to Copy
import * as Sentry from "@sentry/cloudflare"; export default Sentry.withSentry( (env) => ({ dsn: 'https://<key>@sentry.io/<project>', tracesSampleRate: 1.0, enableLogs: true, }), { async fetch(request, env, ctx) { return new Response('Hello World!'); }, } );

Check our documentation for the latest instructions.

See all platforms

More than 150K Organizations Trust Sentry with Their Application Monitoring

Github logo
Atlassian logo
Disney logo
Cloudflare logo
Microsoft logo
Lush logo

Code-Level Visibility

View stack traces on issues, user-agent information, and all the metadata around an issue for all the context needed to resolve the issue.

Quickly Identify Function Latencies

Trace those ten-second page loads to poor-performing API calls and slow database queries. The event detail waterfall visually highlights what calls are giving your customers a poor experience.

Fill in the Gaps

See what happened leading up to the issue. Get function execution details including function metadata, execution time, Amazon Resource Name, and function identity.

Custom Dashboards and Reporting

Learn from issues and release data to uncover trends and identify opportunities across your entire system .

FAQs

Supporting Resources

The Sentry Blog

A better experience for your users. An easier life for your developers.