Skip to content

[Vite] User data dropped in bundled version datadog-rum 6.0.0 #246

@jnelken

Description

@jnelken

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

  1. 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 },
    }),
    ];

  2. 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",
    });

  3. Trigger a view or resource so a RUM batch is sent.

———

Observed behaviour

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions