Skip to content
Sentry Client for Cloudflare Workers
JavaScript
Branch: master
Clone or download

README.md

Sentry Client for Cloudflare Workers

This client attempts to adhere to the Sentry SDK Guidelines and works inside a Cloudflare Workers environment.

Usage

  1. Install it: npm install --save tlianza/pigeon
  2. Initialize the client in your worker
    import * as Pigeon from "pigeon";
    
    // Your cloudflare worker starts here
    addEventListener("fetch", event => {
      // Initialize the client with your DSN & current event
      Pigeon.init({
        dsn: "YOUR_DSN",
        event: event
      });
    
      // Make sure this is on.
      event.passThroughOnException();
      
      //Rest of your logic/routing/etc here.
    });
  3. Use it within your code like this:
    Pigeon.captureMessage("Test Message");
    
    Pigeon.captureException(new Error("TEST Error"));
    
    Pigeon.addBreadcrumb({
        category: 'method',
        message: 'Method "testmethod" was called',
        level: Severity.Info
    });

What do you get in Sentry?

You should see all of the expected request info. Stack traces should be present but line numbers will be a little sad if your code is webpacked/wrangled up. Still, you'll get the appropriate column numbers.

Sentry Example Screenshot

This is a real example from debugging the "not my phone" app.

Why is it called Pigeon?

It seemed like the Sentry clients were all named after birds (Raven, etc) and a Pigeon is a "worker bird".

You can’t perform that action at this time.