@thomas-adam-leigh/elenjical-cloudflare
v0.3.0
Published
Elenjical error tracking and logs for Cloudflare Workers and Pages.
Maintainers
Readme
@elenjical/cloudflare
Error tracking and logs for Cloudflare Workers, Pages Functions, Durable Objects and Workflows, reported to Elenjical.
Install
npm install @elenjical/cloudflare@npm:@thomas-adam-leigh/elenjical-cloudflare@^0.3.0Enable Node.js compatibility in your wrangler configuration ("compatibility_flags": ["nodejs_compat"]).
Set up
Set the ELENJICAL_DSN secret (and optionally ELENJICAL_ENVIRONMENT, ELENJICAL_RELEASE) and wrap your
handler:
import * as Elenjical from "@elenjical/cloudflare";
interface Env extends Elenjical.ElenjicalEnv {}
export default Elenjical.withElenjical(
(env: Env) => ({}), // options returned here take precedence over the ELENJICAL_* bindings
{
async fetch(request, env, ctx) {
return new Response("ok");
},
} satisfies ExportedHandler<Env>,
);withElenjical reports uncaught errors and flushes events and logs before each invocation ends. For other
entry points: instrumentDurableObjectWithElenjical, instrumentWorkflowWithElenjical,
instrumentAgentWithElenjical, and elenjicalPagesPlugin for Pages Functions.
See NOTICE for the open-source software this package is built on.
