2
0

chore: 👷 Add user info on Google sheets endpoints for Sentry

This commit is contained in:
Baptiste Arnaud
2022-03-02 07:41:08 +01:00
parent 8029775660
commit 0e14a238be
4 changed files with 6 additions and 2 deletions

View File

@ -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 })
@ -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)

View File

@ -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 })
@ -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()

View File

@ -9,5 +9,6 @@ Sentry.init({
ignoreErrors: [
'ResizeObserver loop limit exceeded',
'ResizeObserver loop completed with undelivered notifications.',
'ResizeObserver is not defined',
],
})

View File

@ -9,5 +9,6 @@ Sentry.init({
ignoreErrors: [
'ResizeObserver loop limit exceeded',
'ResizeObserver loop completed with undelivered notifications.',
'ResizeObserver is not defined',
],
})