errorcore

Configuration

Most integrations need a small, explicit config. The important parts are service identity, capture scope, encryption, and a transport fallback when delivery fails.

errorcore.init()
import errorcore from "errorcore";

errorcore.init({
  service: "billing-api",
  environment: process.env.NODE_ENV ?? "production",
  release: process.env.GIT_SHA,
  captureIO: true,
  captureLocals: true,
  encryptionKey: process.env.ERRORCORE_KEY,
  deadLetterDir: ".errorcore/dead-letter",
  scrub: {
    headers: ["authorization", "cookie"],
    env: ["DATABASE_URL", "JWT_SECRET"],
    body: ["password", "token"],
  },
});

Use these defaults unless you have a clear reason not to:

  • always set service, environment, and release
  • keep captureIO enabled for non-trivial services
  • keep captureLocals enabled unless policy forbids it
  • provide encryption key material from secret management
  • enable dead-letter storage for any service where incidents must survive collector outages

On this page