Skip to main content
A Cloudflare Workers application can report errors to AppSignal using the AppSignal for JavaScript integration. It reports errors only, with no performance data, traces, or metrics.

Module workers

A module worker receives its secrets and environment variables on the env argument of the fetch handler. Create the Appsignal instance inside the handler, where env is available.

Set up

Add the package to your worker project:
Store the Front-end API key for the app you want to report to, listed under the “Push & deploy” section of that app’s settings, as a worker secret:
A wrong key fails silently: the Push API responds with a 401, sendError discards it, and you get no log line and no incident. Trigger an error after your first deploy and confirm it appears in AppSignal.
Create the instance in the fetch handler, and pass caught errors to sendError:
Uncaught exceptions are not reported automatically, so catch errors in your worker and pass them to sendError yourself. For the options you can set on the instance, see the configuration section. For the metadata you can add to an error, see the error handling guide.

Further reading

Our blog post “How to debug Cloudflare Workers with AppSignal” walks through a worker project from scratch.