⬆️ Upgrade sentry and improve its reliability
This commit is contained in:
@@ -18,6 +18,7 @@ import { Ratelimit } from '@upstash/ratelimit'
|
||||
import { Redis } from '@upstash/redis/nodejs'
|
||||
import got from 'got'
|
||||
import { env } from '@typebot.io/env'
|
||||
import * as Sentry from '@sentry/nextjs'
|
||||
|
||||
const providers: Provider[] = []
|
||||
|
||||
@@ -134,6 +135,14 @@ export const authOptions: AuthOptions = {
|
||||
signIn: '/signin',
|
||||
newUser: env.NEXT_PUBLIC_ONBOARDING_TYPEBOT_ID ? '/onboarding' : undefined,
|
||||
},
|
||||
events: {
|
||||
signIn({ user }) {
|
||||
Sentry.setUser({ id: user.id })
|
||||
},
|
||||
signOut() {
|
||||
Sentry.setUser(null)
|
||||
},
|
||||
},
|
||||
callbacks: {
|
||||
session: async ({ session, user }) => {
|
||||
const userFromDb = user as User
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createContext } from '@/helpers/server/context'
|
||||
import { trpcRouter } from '@/helpers/server/routers/v1/trpcRouter'
|
||||
import { captureException } from '@sentry/nextjs'
|
||||
import * as Sentry from '@sentry/nextjs'
|
||||
import { createNextApiHandler } from '@trpc/server/adapters/next'
|
||||
|
||||
export default createNextApiHandler({
|
||||
@@ -8,7 +8,7 @@ export default createNextApiHandler({
|
||||
createContext,
|
||||
onError({ error }) {
|
||||
if (error.code === 'INTERNAL_SERVER_ERROR') {
|
||||
captureException(error)
|
||||
Sentry.captureException(error)
|
||||
console.error('Something went wrong', error)
|
||||
}
|
||||
return error
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createContext } from '@/helpers/server/context'
|
||||
import { trpcRouter } from '@/helpers/server/routers/v1/trpcRouter'
|
||||
import { captureException } from '@sentry/nextjs'
|
||||
import * as Sentry from '@sentry/nextjs'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { createOpenApiNextHandler } from 'trpc-openapi'
|
||||
import cors from 'nextjs-cors'
|
||||
@@ -15,7 +15,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
createContext,
|
||||
onError({ error }) {
|
||||
if (error.code === 'INTERNAL_SERVER_ERROR') {
|
||||
captureException(error)
|
||||
Sentry.captureException(error)
|
||||
console.error('Something went wrong', error)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user