2
0

⬆️ Upgrade sentry and improve its reliability

This commit is contained in:
Baptiste Arnaud
2023-10-07 12:03:42 +02:00
parent 15823df6bd
commit 3e7b9b3afd
23 changed files with 1931 additions and 1726 deletions

View File

@ -8,8 +8,8 @@
"dependencies": {
"@paralleldrive/cuid2": "2.2.1",
"@planetscale/database": "^1.8.0",
"@sentry/nextjs": "7.66.0",
"@trpc/server": "10.34.0",
"@sentry/nextjs": "7.73.0",
"@trpc/server": "10.40.0",
"@typebot.io/emails": "workspace:*",
"@typebot.io/env": "workspace:*",
"@typebot.io/lib": "workspace:*",

View File

@ -10,7 +10,7 @@ import {
} from '@typebot.io/schemas/features/whatsapp'
import { convertMessageToWhatsAppMessage } from './convertMessageToWhatsAppMessage'
import { sendWhatsAppMessage } from './sendWhatsAppMessage'
import { captureException } from '@sentry/nextjs'
import * as Sentry from '@sentry/nextjs'
import { HTTPError } from 'got'
import { convertInputToWhatsAppMessages } from './convertInputToWhatsAppMessage'
import { isNotDefined } from '@typebot.io/lib/utils'
@ -108,7 +108,7 @@ export const sendChatReplyToWhatsApp = async ({
})
}
} catch (err) {
captureException(err, { extra: { message } })
Sentry.captureException(err, { extra: { message } })
console.log('Failed to send message:', JSON.stringify(message, null, 2))
if (err instanceof HTTPError)
console.log('HTTPError', err.response.statusCode, err.response.body)
@ -139,7 +139,7 @@ export const sendChatReplyToWhatsApp = async ({
credentials,
})
} catch (err) {
captureException(err, { extra: { message } })
Sentry.captureException(err, { extra: { message } })
console.log('Failed to send message:', JSON.stringify(message, null, 2))
if (err instanceof HTTPError)
console.log('HTTPError', err.response.statusCode, err.response.body)
@ -209,7 +209,7 @@ const executeClientSideAction =
credentials: context.credentials,
})
} catch (err) {
captureException(err, { extra: { message } })
Sentry.captureException(err, { extra: { message } })
console.log('Failed to send message:', JSON.stringify(message, null, 2))
if (err instanceof HTTPError)
console.log('HTTPError', err.response.statusCode, err.response.body)

View File

@ -58,7 +58,8 @@ export const startWhatsAppSession = async ({
const publicTypebotWithMatchedCondition = botsWithWhatsAppEnabled.find(
(publicTypebot) =>
publicTypebot.settings.whatsApp?.startCondition &&
(publicTypebot.settings.whatsApp?.startCondition?.comparisons.length ??
0) > 0 &&
messageMatchStartCondition(
incomingMessage ?? '',
publicTypebot.settings.whatsApp?.startCondition