Introduction
@lerix-dev/lerix-edge is the Lerix SDK for edge runtimes: Supabase Edge
Functions, Cloudflare Workers, Vercel and Next.js edge routes, Netlify Edge,
Deno Deploy and Bun. Wrap your handler once and every error it throws is
reported to the dashboard with its stack trace and request. The same package
can trace requests and send push notifications to your users.
It uses Web-standard APIs only (fetch, Web Crypto) and has no dependencies.
Nothing is sent until the first report, and reports go out after the response
through the platform’s waitUntil, so a healthy function pays nothing.
Create a project with the Edge Functions framework in the
dashboard and copy its API key and project id
from Project Settings.
1. Install and initialize
- Supabase
- Cloudflare Workers
- Vercel / Next.js
- Deno / Bun
Store the keys as function secrets:Import the package with an Reports are sent after the response through
npm: specifier and wrap the handler you pass
to Deno.serve:supabase/functions/send-welcome-email/index.ts
EdgeRuntime.waitUntil.2. Verify the integration
Throw from the handler once:500 and the error appears in your
dashboard within seconds, with the request’s method,
URL and route. Remove the test afterwards.
Options
How your function appears in the dashboard
The function registers as aserver app named after app.id, once per
runtime (deno, workerd, edge-light, bun). Reports show where they ran,
for example supabase:eu-central-1.
Edge isolates have no disk to keep an id in, so the SDK registers under a
stable install id (server:<environment> by default). Every isolate and
cold start of the same function and environment maps to the same user in the
dashboard, instead of one new user per cold start.
Next steps
Error Tracking
What
wrap() reports, the error response, and manual reporting.Request Tracing
A span per request, with
fetch and Supabase database calls.Push Notifications
Send push from a function, e.g. on a database webhook.