-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Summary
When the Vite plugin injects the RUM SDK, network payloads end up carrying sdk_version:6.0.0 With that bundled runtime the user context never leaves the browser: datadogRum.getUser() returns the correct data locally, but every batch sent to browser-intake contains only usr.anonymous_id. This causes user-level data to disappear once it reaches Datadog.
———
Steps to reproduce
-
Create a Vite project and add the Datadog plugin:
// config/datadog.ts (excerpt)
import { datadogVitePlugin } from "@datadog/vite-plugin";export const createDatadogPlugins = (env, viteConfig) => [
datadogVitePlugin({
rum: { enable: true, sdk: {...} },
output: { enable: true },
}),
]; -
Initialize the SDK via the plugin and set the user at runtime:
datadogRum.setUser({
id: "5200b4be-4a99-4139-923d-8b3afba30417",
email: "demotax@concentro.io",
name: "Jake Sunbright",
subscriberId: "abc123",
role: "admin",
}); -
Trigger a view or resource so a RUM batch is sent.
———
Observed behaviour
-
window.DD_RUM.getUser() returns the data above (see screenshot/console log).
-
The request body sent to https://browser-intake-us5-datadoghq.com/api/v2/rum?... contains only:
"usr": {
"anonymous_id": "w6k3ezz616"
}
Example payload (truncated):
{
"_dd": { "format_version": 2, "configuration": { "session_sample_rate": 100 } },
"application": { "id": "d742562c-bd6a-4c48-981b-2419ee46c2a9" },
"service": "shopist",
"version": "690c23ec0dc9e10008b23dac",
"view": { "id": "0a732364-0b78-4f10-838f-1144596c7115", "url": "…" },
"usr": { "anonymous_id": "w6k3ezz616" }
}
———
Environment
- @datadog/vite-plugin: 3.0.7
- Vite: 5.x
———
Request
Please update the Vite plugin so it bundles a recent SDK. Ideally the plugin would expose an option to keep context storage enabled. Right now the 6.0.0 runtime strips usr and makes it impossible to analyse RUM data by authenticated user.