Skip to content

chore(open-next): add server-side sentry to open-next site#8830

Open
dario-piotrowicz wants to merge 3 commits intonodejs:mainfrom
dario-piotrowicz:dario/DEVX-2481/sentry-to-open-next-worker
Open

chore(open-next): add server-side sentry to open-next site#8830
dario-piotrowicz wants to merge 3 commits intonodejs:mainfrom
dario-piotrowicz:dario/DEVX-2481/sentry-to-open-next-worker

Conversation

@dario-piotrowicz
Copy link
Copy Markdown
Member

Description

This PR adds server-side sentry to the open-next site.

Validation

To be done.

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

Copilot AI review requested due to automatic review settings April 19, 2026 23:00
@dario-piotrowicz dario-piotrowicz requested review from a team as code owners April 19, 2026 23:00
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 19, 2026

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

Project Deployment Actions Updated (UTC)
nodejs-org Ready Ready Preview Apr 20, 2026 3:53pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 19, 2026

PR Summary

Medium Risk
Changes the production worker entrypoint and enables Sentry sendDefaultPii plus full tracing, which can affect runtime behavior and data/telemetry volume if misconfigured.

Overview
Adds a custom Cloudflare worker entrypoint (cloudflare/worker-entrypoint.ts) that wraps the OpenNext-generated worker with @sentry/cloudflare to capture errors, logs, and 100% tracing, while re-exporting DOQueueHandler for Durable Objects.

Updates Wrangler to use this entrypoint as main and adds a version_metadata binding (CF_VERSION_METADATA) for Sentry release association. Tooling/docs are adjusted: adds @sentry/cloudflare and @cloudflare/workers-types, and excludes the entrypoint from tsc and type-aware ESLint due to a TypeScript compiler crash triggered by its imports.

Reviewed by Cursor Bugbot for commit 3c40dba. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website @nodejs/web-infra

Please review the changes when you have a chance. Thank you! 🙏

Comment thread apps/site/cloudflare/worker-entrypoint.ts
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.88%. Comparing base (333d70f) to head (3c40dba).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8830   +/-   ##
=======================================
  Coverage   73.88%   73.88%           
=======================================
  Files         105      105           
  Lines        8889     8889           
  Branches      326      326           
=======================================
  Hits         6568     6568           
  Misses       2320     2320           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


export default Sentry.withSentry(
() => ({
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Placeholder Sentry DSN makes monitoring non-functional

High Severity

The dsn is set to the example placeholder 'https://examplePublicKey@o0.ingest.sentry.io/0' from the Sentry docs, which won't deliver events to any real Sentry project. Additionally, the withSentry config callback uses () => ({...}) instead of (env) => ({...}) — the env parameter is how the Sentry Cloudflare SDK provides access to worker environment bindings, which is the standard way to read env.SENTRY_DSN at runtime. Without both a valid DSN and the env parameter, the entire Sentry integration this PR adds is non-functional.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b7b2263. Configure here.

This comment was marked as low quality.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Dario Piotrowicz <dario.piotrowicz@gmail.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0f161be. Configure here.

// Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
// Learn more at
// https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/options/#tracesSampleRate
tracesSampleRate: 1.0,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Full trace sampling rate unsuitable for production traffic

Medium Severity

tracesSampleRate: 1.0 instruments 100% of requests. For a high-traffic production site like nodejs.org, this adds latency to every request and can generate massive Sentry billing costs. Sentry's own docs recommend a lower value (e.g., 0.2) for production. This appears to be copy-pasted boilerplate from Sentry's getting-started guide and is likely to be overlooked when the placeholder DSN is replaced with a real one.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0f161be. Configure here.

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.

@dario-piotrowicz please adjust this

Copy link
Copy Markdown
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

Why are we doing this? Where the need of adding Sentry comes from?

Comment thread apps/site/cloudflare/worker-entrypoint.ts Outdated
@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 20, 2026

@dario-piotrowicz please don't use Copilot. We're using Cursor on this repository for now :)

@dario-piotrowicz
Copy link
Copy Markdown
Member Author

@dario-piotrowicz please don't use Copilot. We're using Cursor on this repository for now :)

oh... I actually didn't do anything (at least I don't think so!)... Copilot just automatically reviewed the PR... 😓

@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 20, 2026

@dario-piotrowicz please don't use Copilot. We're using Cursor on this repository for now :)

oh... I actually didn't do anything (at least I don't think so!)... Copilot just automatically reviewed the PR... 😓

No? You explicitly requested a review from it

image

@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 20, 2026

If that's not the case, I'd recommend you to review your Copilot settings, IDK 😅

@dario-piotrowicz
Copy link
Copy Markdown
Member Author

no, I didn't... 😕 😓 🤷

@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 20, 2026

no, I didn't... 😕 😓 🤷

image

@dario-piotrowicz
Copy link
Copy Markdown
Member Author

If that's not the case, I'd recommend you to review your Copilot settings, IDK 😅

Maybe this was the problem 🤷
Screenshot 2026-04-20 at 16 40 15

I've disabled it now 😅👍

dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/options/#sendDefaultPii
sendDefaultPii: true,
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.

@dario-piotrowicz disable this please

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.

Why do we need to disable this? This is pretty important for allowing Sentry to properly tell us the scope of an issue in terms of user impact etc.

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.

@dario-piotrowicz we had Sentry in the past with good chunk of customization, could you please go through GitHub history and check it out (just to compare what we had at the time)

Copy link
Copy Markdown
Member

@MattIPv4 MattIPv4 Apr 20, 2026

Choose a reason for hiding this comment

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

We should replicate the settings that we use on the release worker, as we know those settings work for us. I don't think historical settings from the Next.js site make much sense as a reference point, given this is Worker instrumentation.

tracesSampleRate: 1.0,
}),
{
async fetch(
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.

What is this fetch override, ooc? 👀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This fetch calls the actual open-next worker

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.

4 participants