✨ NextJS Add addNextJSError component#4289
Conversation
|
@codex pls review |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: aecc13f | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
|
@codex pls review |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
| /// <reference types="next" /> | ||
| /// <reference types="next/image-types/global" /> | ||
| import "./.next/types/routes.d.ts"; | ||
| import "./.next/dev/types/routes.d.ts"; |
There was a problem hiding this comment.
Revert edits to generated next-env declaration
next-env.d.ts is a Next.js-generated file ("NOTE: This file should not be edited"), and /workspace/browser-sdk/AGENTS.md explicitly says generated files must never be manually modified; committing the import change to ./.next/dev/types/routes.d.ts hard-codes a dev-only generated path that gets rewritten by Next and can fail on clean/typecheck builds before .next/dev exists. Please drop this manual edit and let Next regenerate the file.
Useful? React with 👍 / 👎.
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— wrapspublicApi.addErrorwith:framework: 'nextjs'context.nextjs.digestcontext when the error has a digest (server component errors) — this hash links client-side errors to server-side logsgetGlobalPublicApi()getter added tonextjsPlugin.tsto expose the RUM public API@datadog/browser-rum-nextjsmain entryerror.tsxandglobal-error.tsxaddNextjsError, server component that throws, andglobal-error.tsxTest instructions
(AI written)
yarn test:unit --spec packages/rum-nextjs/src/domain/addNextjsError.spec.ts(6 specs)yarn test:e2e -g "addNextjsError"(2 scenarios — client error + server error with digest)React StrictModedouble-firesuseEffectin dev mode, so E2E tests assert >= 1 custom errors rather than exactly 1Checklist