Skip to content

fix(rum-legacy): send user and account identifiers as strings - #49

Merged
Fiona2016 merged 1 commit into
publishfrom
fix/legacy-user-string-fields
Oct 17, 2026
Merged

Fiona2016 merged 1 commit into
publishfrom
fix/legacy-user-string-fields

Conversation

@Fiona2016

Copy link
Copy Markdown
Collaborator

Problem

The intake decodes usr.id, usr.name, usr.email, account.id and account.name as strings and rejects the whole event when one of them is a number.

The modern bundle converts these fields with String() before attaching them (ensureProperties in packages/core/src/domain/context/contextManager.ts). The legacy bundle stored them as given. A page that calls setUser({ id: 12345 }) therefore reports normally from modern browsers but loses every event from IE9-11.

Change

setUser, setUserProperty, setAccount and setAccountProperty in packages/rum-legacy now convert the same fields the same way:

  • Empty values (undefined, null, '') are left alone, as in the modern bundle, rather than sent as "null".
  • Custom fields keep their type.

Verification

  • Four new specs in publicApi.spec.ts. Three of them failed before the change (numbers went out as numbers) and pass after it. The empty-value spec passed both before and after.
  • yarn test:unit: 3193 passed.
  • packages/rum-legacy: yarn build:bundle passes the ES5 parse, missing-API, reserved-word and legacy runtime checks.
  • Typecheck, lint and prettier are clean on the changed files.

The intake decodes usr.id, usr.name, usr.email, account.id and
account.name as strings and rejects the whole event when one of them is
a number. The modern bundle converts these fields with String() before
attaching them; the legacy bundle stored them as given, so a page that
passed a numeric user id lost every event from IE9-11 while the same
page reported normally from other browsers.

setUser, setUserProperty, setAccount and setAccountProperty now convert
the same fields the same way. Empty values (undefined, null, '') are left
alone, as in the modern bundle, and custom fields keep their type.
@Fiona2016
Fiona2016 merged commit 6496c98 into publish Oct 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant