Skip to content

chore: update sentry config#2828

Open
mmioana wants to merge 4 commits intodevelopfrom
chore/update-sentry-config
Open

chore: update sentry config#2828
mmioana wants to merge 4 commits intodevelopfrom
chore/update-sentry-config

Conversation

@mmioana
Copy link
Copy Markdown
Contributor

@mmioana mmioana commented Apr 24, 2026

Which Jira task belongs to this PR?

Why did I implement it this way?

Checklist before requesting a review

  • I have performed a self-review of my code
  • This pull request is as small as possible and only tackles one problem
  • I have added tests that cover the functionality / test the bug
  • If this changed the API, I have updated the documentation
  • I have provided QA instructions for the feature / fix implemented in this PR (if applicable)
  • I have provided instructions for any environment / deployment changes that this PR needs when merged

Summary by CodeRabbit

  • New Features

    • Wallet connection lifecycle is tracked in error monitoring; monitoring tunnel routing enabled.
  • Bug Fixes

    • Error reporting now consistently captures exceptions across environments.
  • Documentation

    • Added Sentry configuration and usage guidance to README.
  • Chores

    • Centralized runtime Sentry configuration and sampling; simplified environment-variable build/runtime handling; removed redundant client-side Sentry packages.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
jumper-exchange Ready Ready Preview, Comment Apr 24, 2026 2:04pm
jumper-exchange-storybook Ready Ready Preview, Comment Apr 24, 2026 2:04pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d82f9686-e290-48ce-b419-c50ed1e23329

📥 Commits

Reviewing files that changed from the base of the PR and between d50aa68 and a8c7070.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • new-types.d.ts
  • src/providers/WalletProvider/WalletProvider.tsx
✅ Files skipped from review due to trivial changes (1)
  • new-types.d.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/providers/WalletProvider/WalletProvider.tsx

Walkthrough

Centralizes Sentry configuration into a shared options module, refactors client/edge/server init to use it, always captures exceptions in error pages, removes Sentry build-time args from the Dockerfile, adds wallet lifecycle Sentry tracking, enables Sentry tunnel routing, and documents Sentry setup in README.

Changes

Cohort / File(s) Summary
Sentry shared config + consumers
src/sentry/sharedOptions.ts, instrumentation-client.ts, sentry.edge.config.ts, sentry.server.config.ts
Adds centralized Sentry option builders and sampling helpers; refactors client/server/edge inits to consume these helpers; switches to debug-gated logging and DSN-based enablement; adjusts Spotlight enablement logic.
Runtime & build envs / types
new-types.d.ts, src/config/env-config.ts, next.config.mjs, Dockerfile
Adds Sentry/Storybook env typings; includes NEXT_PUBLIC_SENTRY_DSN in client build-time fallback; enables Sentry tunnel route (/monitoring); removes Docker ARG→ENV propagation and documents using .env or build environment.
Error reporting pages
src/app/[lng]/error.tsx, src/app/global-error.tsx
Removes production-only guard and always calls captureException() when errors occur.
Wallet tracking integration
src/providers/WalletProvider/WalletProvider.tsx
Sets Sentry user and chain tags on wallet connect; clears user and tags on disconnect; registers disconnect listener.
Deps & docs
package.json, README.md
Removes @sentry/browser and @sentry/react from dependencies; updates README with build/runtime Sentry configuration, flags, and Vercel note.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant NextServer as Next.js Server
  participant Edge as Edge Runtime
  participant Sentry

  Client->>NextServer: app requests / (includes Sentry init using sharedOptions)
  Note over Client,NextServer: client uses getSentryBaseOptions('client') and replay rates
  NextServer->>Edge: server/edge inits call getSentryBaseOptions('server'/'edge')
  NextServer->>Sentry: send errors/traces via tunnelRoute (/monitoring)
  Client->>Sentry: browser events (DSN configured via shared options)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fix: sentry config #2457: Refactors Sentry initialization and sampling across client/server/edge; touches the same Sentry config files.

Suggested reviewers

  • oktapodia
  • callMeTheQA

Poem

🐰 I hopped through configs, tidy and quick,
Shared options now make Sentry tick.
Wallets announce, then clear with a hop,
Errors get caught—no more "maybe" stop.
Tunnel lit, docs baked—now off I flip! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'chore: update sentry config' is vague and generic, using non-descriptive terms that don't convey meaningful information about the specific changes made to Sentry configuration. Consider a more specific title that reflects the main changes, such as 'chore: refactor Sentry configuration to use shared options builders' or 'chore: centralize Sentry configuration and add tunnel route setup'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/update-sentry-config

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

✅ All snapshot tests passed

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

Playwright test results

passed  52 passed
flaky  3 flaky
skipped  1 skipped

Details

stats  56 tests across 11 suites
duration  3 minutes, 46 seconds
commit  a8c7070

Flaky tests

chromium › landingPage.spec.ts › Landing page and navigation › Should navigate to the homepage and change tabs (Qase ID: 2)
chromium › mobileView.spec.ts › Verify essential mobile flows › Verify items in the menu (Qase ID: 6)
chromium › settings.spec.ts › Settings menu [Viewport: Desktop] › Should verify all settings menu functionality (Qase ID: 8)

Skipped tests

chromium › themeManipulation.spec.ts › Switch between dark and light theme and check the background color › Partner theme should appear in theme menu and apply background color (Qase ID: 49)

📋 View Detailed Qase Report

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@new-types.d.ts`:
- Around line 12-21: The ProcessEnv type currently marks environmental keys like
SENTRY_SPOTLIGHT, NEXT_PUBLIC_SENTRY_DSN, SENTRY_TRACES_SAMPLE,
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE, NEXT_PUBLIC_SENTRY_REPLAY_SESSION,
NEXT_PUBLIC_SENTRY_REPLAY_ON_ERROR, NEXT_PUBLIC_SENTRY_ENABLE_LOGS,
NEXT_PUBLIC_SENTRY_CONSOLE, STORYBOOK and NEXT_PUBLIC_STORYBOOK as required
strings; change their declarations in the ProcessEnv augmentation so they are
optional (e.g., SENTRY_SPOTLIGHT?: string or string | undefined) to match
runtime code that treats them as possibly absent and uses fallbacks—update the
type definitions around ProcessEnv to reflect optionality for those specific
symbols.

In `@src/providers/WalletProvider/WalletProvider.tsx`:
- Around line 115-117: Update handleWalletDisconnected to also clear the wallet
chain tags so Sentry doesn't retain stale context: after calling setUser(null)
invoke Sentry.setTag for the tags named "wallet.chainType" and "wallet.chainId"
(or otherwise set the local wallet state fields wallet.chainType and
wallet.chainId to undefined) rather than using sentinel values, ensuring both
Sentry tags and any wallet state are cleared on disconnect.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 372f2288-ed6b-477a-93cf-b4a5f6d64ded

📥 Commits

Reviewing files that changed from the base of the PR and between 6c1bbde and d50aa68.

📒 Files selected for processing (13)
  • Dockerfile
  • README.md
  • instrumentation-client.ts
  • new-types.d.ts
  • next.config.mjs
  • package.json
  • sentry.edge.config.ts
  • sentry.server.config.ts
  • src/app/[lng]/error.tsx
  • src/app/global-error.tsx
  • src/config/env-config.ts
  • src/providers/WalletProvider/WalletProvider.tsx
  • src/sentry/sharedOptions.ts
💤 Files with no reviewable changes (1)
  • package.json

Comment thread new-types.d.ts Outdated
Comment thread src/providers/WalletProvider/WalletProvider.tsx
mmioana and others added 2 commits April 24, 2026 16:11
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@chmanie chmanie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good, let's try this one! Few tiny comments only!

Comment thread src/app/[lng]/error.tsx
reset: () => void;
}) {
useEffect(() => {
if (isProduction) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean we also capture on develop and staging as well?

Comment thread src/config/env-config.ts
process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ?? '',
NEXT_PUBLIC_NOTIFICATIONS_URL:
process.env.NEXT_PUBLIC_NOTIFICATIONS_URL ?? '',
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN ?? '',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to expose this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's origin blocked and the common way of setting it up

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really shared? I want to prepare a package that we can share between the backend and the notification system. I am expecting to also integrate Sentry there as well at some point. Maybe we can move that file there as well?

const isClient = runtime === 'client';
const tracesSampleRate = getTracesSampleRate(isClient, prod);

const enableLogs = prod
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah it moved here, I see!

Comment thread sentry.edge.config.ts

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: !isProduction,
init({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Hmm, can't this just be init(base)? Or is init modifying the base object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants