Repository navigation
fix(rum-legacy): send user and account identifiers as strings - #49
Conversation
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.
|
Reviewed as part of this week's SDK/component-library review. The coercion itself matches the modern bundle: One gap, documentation/contract only, not blocking: The coercion also changes what the getters return. A page that pins the old type breaks silently after upgrading: Suggestion, both cheap:
Filed as a comment rather than a PR: I could not run |
Problem
The intake decodes
usr.id,usr.name,usr.email,account.idandaccount.nameas strings and rejects the whole event when one of them is a number.The modern bundle converts these fields with
String()before attaching them (ensurePropertiesinpackages/core/src/domain/context/contextManager.ts). The legacy bundle stored them as given. A page that callssetUser({ id: 12345 })therefore reports normally from modern browsers but loses every event from IE9-11.Change
setUser,setUserProperty,setAccountandsetAccountPropertyinpackages/rum-legacynow convert the same fields the same way:undefined,null,'') are left alone, as in the modern bundle, rather than sent as"null".Verification
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:bundlepasses the ES5 parse, missing-API, reserved-word and legacy runtime checks.