Skip to content

Commit

Permalink
fix: sentry user data now augments correctly (#136) (#147)
Browse files Browse the repository at this point in the history
* fix: sentry user data now augments correctly (#136)

* chore: use environment

* chore: update environment to use vercel env where applicable
  • Loading branch information
NicholasG04 authored Mar 19, 2022
1 parent 8b31739 commit 242545d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions sentry.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Sentry.init({
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
environment: process.env.VERCEL_ENV ?? process.env.NODE_ENV,
});
1 change: 1 addition & 0 deletions sentry.server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Sentry.init({
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
environment: process.env.VERCEL_ENV ?? process.env.NODE_ENV,
});
8 changes: 5 additions & 3 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import theme from '../util/theme';
const App: NextPage<AppProps> = ({ Component, pageProps }) => {
useAnalytics({ publicKey: process.env.NEXT_PUBLIC_HAPPYKIT_ANALYTICS_PUBLIC_KEY });
useEffect(() => {
const { data: authListener } = supabaseClient.auth.onAuthStateChange(async (_, session) => {
if (!session) Sentry.setUser(null);
else {
console.log('effect');
const { data: authListener } = supabaseClient.auth.onAuthStateChange((event, session) => {
if (event === 'SIGNED_OUT') {
Sentry.setUser(null);
} else if (session) {
Sentry.setUser({
email: session.user.email,
username: session.user.user_metadata.proper_name,
Expand Down

0 comments on commit 242545d

Please sign in to comment.