Repository navigation
fix(rum-legacy): send user and account identifiers as strings - #49
Merged
Merged
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.
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.
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.