Shadow: ⚗️ Add Nuxt error tracking (v5)#94
Open
allspain wants to merge 9 commits into
Open
Conversation
…racking, and update tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shadow Review — PR
#4477v5Source:
DataDog/browser-sdk#4477Commit:
b13420280c15615b1f0f5cd317725b7fec5cb743Timestamp: 2026-04-20T07:45:14Z
Original PR Description
Motivation
This PR adds first-class Nuxt error tracking, covering both Vue rendering/lifecycle errors (via
vueApp.config.errorHandler) and Nuxt startup errors thrown in plugins or app hooks (via theapp:errorhook).Changes
New public APIs (exported from
@datadog/browser-rum-nuxt)addNuxtError(error, instance, info)— a low-level function compatible with bothvueApp.config.errorHandlerand Nuxt'sapp:errorhook. Intended for users who want manual control. It:infostringdd_contextproperty from the error object (if present) into the event contextframework: 'nuxt'datadogRum.initcompletessetupNuxtErrorHandling(nuxtApp)— a convenience helper that sets up both handlers automatically. It:vueApp.config.errorHandler(preserving Nuxt's own error page handler)app:errorfor errors thrown during plugin/app startupWeakSet-based deduplication to prevent double-reporting when the same error bubbles through botherrorHandlerandapp:errorInternal changes
nuxtRumPluginnow implements theonRumStartlifecycle hook to receive and distribute theaddErrorfunction to buffered subscriberscreateHandlingStackextended with a'nuxt error'source labelTest instructions
Unit tests:
E2E tests:
yarn test:e2e:init yarn test:e2e -g "nuxt error"Manual:
/error-test. Click "Trigger Error" and verify a single RUM error event is collected witherror.source: custom,context.framework: nuxt, and ahandling_stack./startup-errorand verify a single RUM error event is collected for the startup error thrown in the plugin, again withcontext.framework: nuxtand ahandling_stack.Checklist