Skip to content

feat(open-next): create cloudflare-sentry-tail package#8842

Open
flakey5 wants to merge 3 commits intomainfrom
flakey5/20260424/tail-worker
Open

feat(open-next): create cloudflare-sentry-tail package#8842
flakey5 wants to merge 3 commits intomainfrom
flakey5/20260424/tail-worker

Conversation

@flakey5
Copy link
Copy Markdown
Member

@flakey5 flakey5 commented Apr 25, 2026

Creates a cloudflare-sentry-tail package that enables us to add a tail worker to the open next deployment of the site.

This package should be publishable as well so that we can reuse it in the release worker.

Description

Validation

Related Issues

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.

Creates a `cloudflare-sentry-tail` package that enables us to add a tail worker
to the open next deployment of the site.

This package should be publishable as well so that we can reuse it in the
release worker.

Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
@flakey5 flakey5 requested review from a team as code owners April 25, 2026 01:17
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

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

Project Deployment Actions Updated (UTC)
nodejs-org Ready Ready Preview Apr 30, 2026 3:14am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 25, 2026

PR Summary

Medium Risk
Introduces new production error-reporting behavior that captures and forwards worker trace data to Sentry; misconfiguration could increase noise/cost or leak sensitive data if header redaction is incomplete.

Overview
Adds a new publishable workspace package, @node-core/cloudflare-sentry-tail, that turns Cloudflare Tail TraceItems into Sentry events, including severity detection (non-ok outcomes and HTTP >=500), request/response context, fingerprints, and breadcrumbs from logs/diagnostic channel events/exceptions with optional header redaction and sampling.

Updates the site’s OpenNext Cloudflare worker-entrypoint to register a tail handler via createSentryTail (sampling rate 1) and to redact sensitive headers, and wires the new workspace dependency/lockfile plus CODEOWNERS coverage for the package.

Reviewed by Cursor Bugbot for commit fc180d5. 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/web-infra @nodejs/nodejs-website

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

Comment thread packages/cloudflare-sentry-tail/src/index.ts Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.24%. Comparing base (97e28c5) to head (fc180d5).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8842      +/-   ##
==========================================
- Coverage   73.87%   73.24%   -0.63%     
==========================================
  Files         105      102       -3     
  Lines        8883     8623     -260     
  Branches      326      313      -13     
==========================================
- Hits         6562     6316     -246     
+ Misses       2320     2306      -14     
  Partials        1        1              

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

Comment thread packages/cloudflare-sentry-tail/src/index.ts Outdated
Comment thread packages/cloudflare-sentry-tail/src/index.ts Outdated
Comment thread packages/cloudflare-sentry-tail/src/index.ts Outdated
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
Comment thread packages/cloudflare-sentry-tail/.lintstagedrc.json
Comment thread packages/cloudflare-sentry-tail/src/index.ts Outdated
Comment thread packages/cloudflare-sentry-tail/package.json
Comment thread packages/cloudflare-sentry-tail/package.json
Comment thread packages/cloudflare-sentry-tail/src/index.ts Outdated
Comment thread packages/cloudflare-sentry-tail/src/index.ts Outdated
Comment thread packages/cloudflare-sentry-tail/src/index.ts Outdated
@@ -0,0 +1,31 @@
{
"name": "@node-core/cloudflare-sentry-tail",
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.

Can you open an issue in admin for this package?

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.

For what exactly?

Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.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.

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 fc180d5. Configure here.


const event: Event = {
level: severityLevel,
timestamp: item.eventTimestamp ?? Date.now(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Timestamps passed in milliseconds instead of required seconds

High Severity

Cloudflare's TraceItem.eventTimestamp is in milliseconds since epoch, and Date.now() also returns milliseconds. However, Sentry's Event.timestamp and Breadcrumb.timestamp fields expect seconds since epoch. Passing milliseconds directly causes Sentry to interpret all event timestamps as dates far in the future (approximately year 50,000+), resulting in validation errors or completely unusable event timeline data. The values need to be divided by 1000.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc180d5. Configure here.

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