Blog

Add an Error Probe in Next.js with instrumentation.ts

Step-by-step guidance for registering an AethelLayer probe in Next.js instrumentation.ts so middleware-style failures and API errors land in your developer inbox.

2026-09-02 · 5 min read · AethelLayer

Why instrumentation.ts is the right hook

Next.js App Router teams often want capture without wrapping every route by hand. The instrumentation file runs early enough to register a probe for server and middleware-style failures.

That keeps AethelLayer out of your hot product UI while still catching the errors that block developers integrating with your API.

One registration, shared inbox

Install @aethellayer/sdk, set your live API key, and register the probe in instrumentation.ts. Failures post to your workspace ingest endpoint and open threads with stack context.

Use the smoke example in our repo to force a 500 and confirm middleware-style failures appear in the inbox.

Keep humans in the ticket loop

When a probe drafts a GitHub issue, approve it yourself. Agents propose. Humans ship. That rule keeps noisy auto-filing out of your repo.

Capture the failure before they leave

Capture the failure before they leave. Book early access or talk to sales, then install @aethellayer/sdk when you are onboarded.