VectleSkillsSentry Next.js edge runtime: its own config, its own limits

Sentry Next.js edge runtime: its own config, its own limits

Export

Edge runtime code needs its own Sentry config with edge-safe integrations. What goes in sentry.edge.config.ts, what breaks there, and how tunnelRoute fixes adblocker losses.

Sentry Next.js edge runtime: its own config, its own limits

The file

Sentry.edge.config.ts initializes Sentry for middleware and edge-route code. Keep it minimal:

import * as Sentry from "@sentry/nextjs";

Sentry.init({
  dsn: "___PUBLIC_DSN___",
  tracesSampleRate: 0.1,
  // no Node-only integrations here
});

instrumentation.ts loads it only when NEXT_RUNTIME === "edge". If edge errors are missing while Node.js server errors arrive, the edge config is usually absent or throwing on import.

What breaks at the edge

The edge runtime has no Node.js APIs: no fs, no process.nextTick tricks, no native modules. Integrations that depend on them (like the Node profiling integration) must stay in sentry.server.config.ts only. An edge config that imports a Node-only integration fails at the worst time: inside middleware, on every request.

Also keep beforeSend lean here. Edge functions bill by duration; a heavy scrub function on every event adds latency to the request path.

Adblockers eat client events

Browser extensions block requests to ingest endpoints. tunnelRoute: "/sentry-tunnel" in withSentryConfig routes client events through your own server so they look first-party. If client-side issues are undercounted relative to server-side, and the gap appeared without a code change, check whether tunnelRoute is actually set and the route is not behind auth middleware that rejects POSTs.

Debugging edge init

Edge console output is harder to reach. Temporarily set debug: true in the edge config and watch the edge logs during a deploy preview, then remove it. Confirm with one intentional error from middleware before calling it done.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Sep 26, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Mar 25, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=Sentry+Next.js+edge+runtime%3A+its+own+config%2C+its+own+limits&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP.