Skip to content

Commit

Permalink
build: 👷 Add Sentry context
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Apr 8, 2022
1 parent 5aac822 commit fb3bba8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/builder/contexts/UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { updateUser as updateUserInDb } from 'services/user/user'
import { useToast } from '@chakra-ui/react'
import { dequal } from 'dequal'
import { User } from 'db'
import { setUser as setSentryUser } from '@sentry/nextjs'

const userContext = createContext<{
user?: User
Expand Down Expand Up @@ -48,7 +49,9 @@ export const UserContext = ({ children }: { children: ReactNode }) => {

useEffect(() => {
if (isDefined(user) || isNotDefined(session)) return
setUser(session.user as User)
const parsedUser = session.user as User
setUser(parsedUser)
setSentryUser({ id: parsedUser.id })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [session])

Expand Down
10 changes: 10 additions & 0 deletions apps/builder/sentry.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@ import * as Sentry from '@sentry/nextjs'
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
ignoreErrors: ['ResizeObserver loop limit exceeded'],
beforeBreadcrumb(breadcrumb, hint) {
try {
if (breadcrumb.category?.startsWith('ui')) {
breadcrumb.message = `${hint?.event.target.tagName.toLowerCase()}: ${
hint?.event.target.innerText
}`
}
} catch (e) {}
return breadcrumb
},
})

4 comments on commit fb3bba8

@vercel
Copy link

@vercel vercel bot commented on fb3bba8 Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on fb3bba8 Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on fb3bba8 Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on fb3bba8 Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

Please sign in to comment.