Skip to content
A template to create a Cloudflare worker that logs errors to Sentry
Branch: master
Clone or download
Pull request Compare This branch is 7 commits ahead, 4 commits behind cloudflare:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE_MIT Port from Gist:… Jul 26, 2019
package.json 1.0.2 Aug 14, 2019


A template to create a Cloudflare worker that logs errors to Sentry.


Use wrangler

wrangler generate projectname

Then edit the config variables in sentry.js to suit your environment:

// Get the key from the "DSN" at:<org>/projects/<project>/keys/
// The "DSN" will be in the form: https://<SENTRY_KEY><SENTRY_PROJECT_ID>
// eg,
const SENTRY_PROJECT_ID = '123456'
const SENTRY_KEY = '0000aaaa1111bbbb2222cccc3333dddd'

// Useful if you have multiple apps within a project – not necessary, only used in TAGS and SERVER_NAME below
const APP = 'my-app'

const ENV = 'development'

// A string describing the version of the release – we just use: git rev-parse --verify HEAD
// You can use this to associate files/source-maps:
const RELEASE = '0000aaaa1111bbbb2222cccc3333dddd'

const TAGS = { app: APP }

const SERVER_NAME = `${APP}-${ENV}`

Then you can build your project, publish it, etc with wrangler:

cd projectname
wrangler build


Licensed under either of

at your option.

You can’t perform that action at this time.