Browse Source

set user context for all sentry call

Abhinav-grd 4 years ago
parent
commit
69a2d03316
1 changed files with 5 additions and 0 deletions
  1. 5 0
      sentry.client.config.js

+ 5 - 0
sentry.client.config.js

@@ -1,8 +1,13 @@
 import * as Sentry from '@sentry/nextjs';
 import { getSentryTunnelUrl } from 'utils/common/apiUtil';
+import { getData, LS_KEYS } from 'utils/storage/localStorage';
+
 
 const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4';
 const SENTRY_ENV = process.env.NEXT_PUBLIC_SENTRY_ENV ?? 'development';
+const userID = getData(LS_KEYS.USER)?.id;
+
+Sentry.setUser({ id: userID });
 Sentry.init({
     dsn: SENTRY_DSN,
     enabled: SENTRY_ENV !== 'development',