Cloudflare Docs
Workers
Edit this page on GitHub
Set theme to dark (⇧+D)

Sentry integration

Beta

Sentry is an error tracking and performance monitoring platform that allows developers to diagnose, fix, and optimize the performance of their code.

This integration allows you to connect to a Sentry project from your Worker to automatically send errors and uncaught exceptions to Sentry with no code changes needed in the Workers application.

​​ How it works

This integration adds a Tail Worker to your application Worker. The Tail Worker automatically sends errors and uncaught exceptions to the Sentry project you have configured.

This integration supports the following Sentry features:

  • Data Handling: As a best practice, do not include PII or other sensitive data in the payload sent to Sentry. HTTP headers (for example, Authorization or Cookie) can be removed before events are forwarded to Sentry.
  • Sampling: Sampling can be configured to manage the number and type of events sent to Sentry. Sampling rates can be configured based on the HTTP status code returned by the Worker and for uncaught exceptions. Setting the sampling rate to 100% sends all events to Sentry or setting it to 30% sends approximately 30% of events to Sentry.
  • Breadcrumbs: Breadcrumbs create a trail of events that happened prior to an issue. Breadcrumbs are automatically forwarded to Sentry in the case of an error or exception. These events consist of the console.log() from the Worker before the error or exception occurred.

​​ Set up an integration with Sentry

To set up an integration with Sentry, you need to have an existing Sentry project to connect to. Create a Sentry project, or use an existing project for this integration. Then add the Sentry integration to your Worker.

To add the Sentry integration to your Worker:

  1. Log in to the Cloudflare dashboard and select your account.
  2. Select Workers & Pages.
  3. In Overview, select your Worker.
  4. Select Integrations > Sentry.
  5. Follow the setup flow.

Once installed, the integration will automatically start forwarding matching events to Sentry. To learn more about Sentry, refer to Sentry’s official documentation.