Skip to content

Commit

Permalink
chore: 👷 Add user info on Google sheets endpoints for Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 2, 2022
1 parent 8029775 commit 0e14a23
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
import { methodNotAllowed } from 'utils'
import { getSession } from 'next-auth/react'
import { User } from 'db'
import { withSentry } from '@sentry/nextjs'
import { setUser, withSentry } from '@sentry/nextjs'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const session = await getSession({ req })
Expand All @@ -13,6 +13,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
return res.status(401).json({ message: 'Not authenticated' })

const user = session.user as User
setUser({ email: user.email ?? undefined, id: user.id })
if (req.method === 'GET') {
const credentialsId = req.query.credentialsId.toString()
const auth = await getAuthenticatedGoogleClient(user.id, credentialsId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
import { isDefined, methodNotAllowed } from 'utils'
import { getSession } from 'next-auth/react'
import { User } from 'db'
import { withSentry } from '@sentry/nextjs'
import { withSentry, setUser } from '@sentry/nextjs'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const session = await getSession({ req })
Expand All @@ -13,6 +13,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
return res.status(401).json({ message: 'Not authenticated' })

const user = session.user as User
setUser({ email: user.email ?? undefined, id: user.id })
if (req.method === 'GET') {
const credentialsId = req.query.credentialsId.toString()

Expand Down
1 change: 1 addition & 0 deletions apps/viewer/sentry.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Sentry.init({
ignoreErrors: [
'ResizeObserver loop limit exceeded',
'ResizeObserver loop completed with undelivered notifications.',
'ResizeObserver is not defined',
],
})
1 change: 1 addition & 0 deletions apps/viewer/sentry.server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Sentry.init({
ignoreErrors: [
'ResizeObserver loop limit exceeded',
'ResizeObserver loop completed with undelivered notifications.',
'ResizeObserver is not defined',
],
})

2 comments on commit 0e14a23

@vercel
Copy link

@vercel vercel bot commented on 0e14a23 Mar 2, 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-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 0e14a23 Mar 2, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.