Skip to content

✨ NextJS Add addNextJSError component#4289

Closed
BeltranBulbarellaDD wants to merge 19 commits intomainfrom
beltran.bulbarella/nextjs-addNextjsError
Closed

✨ NextJS Add addNextJSError component#4289
BeltranBulbarellaDD wants to merge 19 commits intomainfrom
beltran.bulbarella/nextjs-addNextjsError

Conversation

@BeltranBulbarellaDD
Copy link
Contributor

@BeltranBulbarellaDD BeltranBulbarellaDD commented Mar 6, 2026

Motivation

Discussed in this RFC specifically here

Changes

(AI written)

Add addNextjsError(error, context?) to @datadog/browser-rum-nextjs. This is the integration point for reporting errors caught by Next.js error boundaries (error.tsx / global-error.tsx) to Datadog RUM.

  • addNextjsError — wraps publicApi.addError with:
    • framework: 'nextjs' context.
    • nextjs.digest context when the error has a digest (server component errors) — this hash links client-side errors to server-side logs
  • getGlobalPublicApi() getter added to nextjsPlugin.ts to expose the RUM public API
  • Exported from @datadog/browser-rum-nextjs main entry
  • README updated with usage section for error.tsx and global-error.tsx
  • E2E test app pages added: client error thrower, error boundary with addNextjsError, server component that throws, and global-error.tsx

Test instructions

(AI written)

  1. Unit tests: yarn test:unit --spec packages/rum-nextjs/src/domain/addNextjsError.spec.ts (6 specs)
  2. E2E tests: yarn test:e2e -g "addNextjsError" (2 scenarios — client error + server error with digest)
  3. Note: React StrictMode double-fires useEffect in dev mode, so E2E tests assert >= 1 custom errors rather than exactly 1

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@BeltranBulbarellaDD
Copy link
Contributor Author

@codex pls review

@datadog-official
Copy link

datadog-official bot commented Mar 6, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 77.37%
Overall Coverage: 77.22% (-0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9080b6f | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@cit-pr-commenter-54b7da
Copy link

cit-pr-commenter-54b7da bot commented Mar 6, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 174.43 KiB 174.43 KiB +2 B +0.00%
Rum Profiler 6.16 KiB 6.16 KiB -2 B -0.03%
Rum Recorder 25.24 KiB 27.46 KiB +2.22 KiB +8.78%
Logs 56.84 KiB 56.84 KiB 0 B 0.00%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 130.11 KiB 130.12 KiB +2 B +0.00%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance

Pending...

🧠 Memory Performance

Pending...

🔗 RealWorld

@BeltranBulbarellaDD
Copy link
Contributor Author

@codex pls review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6c24fa210

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BeltranBulbarellaDD BeltranBulbarellaDD marked this pull request as ready for review March 9, 2026 08:12
@BeltranBulbarellaDD BeltranBulbarellaDD requested review from a team as code owners March 9, 2026 08:12
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aecc13fe47

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BeltranBulbarellaDD BeltranBulbarellaDD marked this pull request as draft March 10, 2026 15:28
@github-actions
Copy link

github-actions bot commented Mar 10, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


5 out of 6 committers have signed the CLA.
✅ (BeltranBulbarellaDD)[https://github.com/BeltranBulbarellaDD]
✅ (amortemousque)[https://github.com/amortemousque]
✅ (thomas-lebeau)[https://github.com/thomas-lebeau]
✅ (thomasbertet)[https://github.com/thomasbertet]
✅ (sethfowler-datadog)[https://github.com/sethfowler-datadog]
@dependabot[bot]
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@BeltranBulbarellaDD BeltranBulbarellaDD force-pushed the beltran.bulbarella/nextjs-addNextjsError branch 2 times, most recently from e366c1e to 9080b6f Compare March 10, 2026 18:02
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants