Skip to Content
Welcome to RitoSwap's documentation!
dAppSentry

Sentry

Sentry is wired through Next.js instrumentation plus explicit capture calls in error boundaries. The setup is split into runtime-specific config files and a shared instrumentation entrypoint.

    • instrumentation.ts
    • instrumentation-client.ts
    • sentry.server.config.ts
    • sentry.edge.config.ts
    • sentry.client.config.ts
      • error.tsx
      • global-error.tsx
        • InlineErrorBoundary.tsx
        • PageError.tsx

Instrumentation entrypoints

  • instrumentation.ts registers Sentry based on process.env.NEXT_RUNTIME and exports onRequestError for server and edge requests.
  • instrumentation-client.ts imports the client config and exports onRouterTransitionStart to track client navigations.

Next.js automatically picks up instrumentation.ts and instrumentation-client.ts when they live at the project root.

Runtime configuration

RuntimeConfig fileDSN sourceEnvironment tagNotes
Clientsentry.client.config.tsNEXT_PUBLIC_SENTRY_DSNNEXT_PUBLIC_ACTIVE_CHAINDebug on in non-production, sendDefaultPii: false, tracesSampleRate: 1, assigns window.Sentry.
Edgesentry.edge.config.tsSENTRY_DSN then NEXT_PUBLIC_SENTRY_DSNSENTRY_ENVIRONMENT then NEXT_PUBLIC_ACTIVE_CHAINUses the same defaults for PII and sampling as client and server.
Serversentry.server.config.tsSENTRY_DSN then NEXT_PUBLIC_SENTRY_DSNSENTRY_ENVIRONMENT then NEXT_PUBLIC_ACTIVE_CHAINDebug on in non-production. Adds domain tag in production.

Default behavior

  • sendDefaultPii is disabled in all runtimes.
  • tracesSampleRate is set to 1 across client, server, and edge.
  • A domain tag is attached in production using NEXT_PUBLIC_DOMAIN.
  • Each config logs its initialization details to the console (DSN present and environment).

Error capture sources

  • InlineErrorBoundary wraps section-level UI and reports exceptions with a component tag plus React component stack context.
  • PageError captures page-level errors.
  • global-error.tsx captures uncaught errors that bubble to the app root.
  • onRequestError and onRouterTransitionStart are exported from instrumentation to hook into Next.js request and navigation flows.

Storybook safety

Storybook aliases @sentry/nextjs to a no-op mock so Sentry does not ship in the Storybook bundle. See dapp/.storybook/main.ts and dapp/.storybook/mocks/sentry.ts.

Environment variables

Set these in addition to the base .env config:

  • NEXT_PUBLIC_SENTRY_DSN (client and edge DSN)
  • SENTRY_DSN (server and edge override)
  • SENTRY_ENVIRONMENT (server and edge override)

See Environment Config for the full variable list.

Last updated on

RitoSwap Docs does not store, collect or access any of your conversations. All saved prompts are stored locally in your browser only.