Fix bug where loaded event is not sent when no user ID (#106090)

This commit is contained in:
Josh Dover 2021-07-19 17:13:01 +02:00 committed by GitHub
parent 59b56e5ac1
commit ab010ae25c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,10 +78,11 @@ export const initializeFullStory = async ({
try {
// This needs to be called syncronously to be sure that we populate the user ID soon enough to make sessions merging
// across domains work
if (!userId) return;
// Do the hashing here to keep it at clear as possible in our source code that we do not send literal user IDs
const hashedId = sha256(userId.toString());
fullStory.identify(hashedId);
if (userId) {
// Do the hashing here to keep it at clear as possible in our source code that we do not send literal user IDs
const hashedId = sha256(userId.toString());
fullStory.identify(hashedId);
}
} catch (e) {
// eslint-disable-next-line no-console
console.error(`[cloud.full_story] Could not call FS.identify due to error: ${e.toString()}`, e);