@squasher-ai/node for Express, Fastify, Hono, Bun, workers, and plain scripts.
Install
Initialize early
Callinit() before you import code that might throw.
src/index.ts
Wrap request handlers
UsewithHttpRequest when you want request metadata attached automatically if the handler throws:
Capture framework errors
- Express
- Fastify
- Hono
Manual capture
Actionable error context
Squasher AI triage works best when errors include a short explanation and a next step. For Node services, send that context as structured attributes on telemetry events:
Keep these values safe to store with remote project telemetry. Put private implementation notes in your own development workflow rather than public-facing docs or customer-visible messages.
For reusable application errors, create the context once and let
captureError merge it into the event:
internal is hidden from the error’s normal JSON representation, but it is still sent to Squasher as event extra. Only include values that are safe for retained project telemetry.
Local debug artifacts
EnablelocalEventSink when you want a coding agent or local debug script to inspect the exact events the SDK prepared after beforeSend.
YYYY-MM-DD.jsonl. Treat them as temporary debugging output for agents and humans. They complement Squasher’s remote observability, but they are not the production source of truth and should not be used for alerting, retention, or incident history.
Agent handoff
Related guides
- Use Pino transport or Winston transport for structured logs.
- Use source maps to improve stack trace quality.
- Use AI triage to turn rich error context into root-cause summaries.