Configuration
Most integrations need a small, explicit config. The important parts are service identity, capture scope, encryption, and a transport fallback when delivery fails.
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, andrelease - keep
captureIOenabled for non-trivial services - keep
captureLocalsenabled unless policy forbids it - provide encryption key material from secret management
- enable dead-letter storage for any service where incidents must survive collector outages