Skip to content

Commit da34232

Browse files
authored
feat(extension): [LW-11934] populate sentry user field (#1575)
1 parent f23ca6e commit da34232

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

apps/browser-extension-wallet/sentry.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as Sentry from '@sentry/react';
2-
2+
import { v4 as uuidv4 } from 'uuid';
3+
import { storage } from 'webextension-polyfill';
34
Sentry.init({
45
environment: process.env.SENTRY_ENVIRONMENT,
56
dsn: process.env.SENTRY_DSN,
@@ -19,3 +20,11 @@ Sentry.init({
1920
// ...plus for 100% of sessions with an error
2021
replaysOnErrorSampleRate: 1.0
2122
});
23+
24+
storage.local.get('SENTRY-UUID').then((storageVar) => {
25+
let sentryUuid = storageVar?.['SENTRY-UUID'] ?? uuidv4();
26+
if (!storageVar?.['SENTRY-UUID']) {
27+
storage.local.set({ 'SENTRY-UUID': sentryUuid });
28+
}
29+
Sentry.setUser({ id: sentryUuid });
30+
});

0 commit comments

Comments
 (0)