diff --git a/packages/server/graphql/executeGraphQL.ts b/packages/server/graphql/executeGraphQL.ts index 8fea40bc2a5..b8685ec669d 100644 --- a/packages/server/graphql/executeGraphQL.ts +++ b/packages/server/graphql/executeGraphQL.ts @@ -8,6 +8,7 @@ import tracer from 'dd-trace' import {graphql} from 'graphql' import {FormattedExecutionResult} from 'graphql/execution/execute' import type {GQLRequest} from '../types/custom' +import sendToSentry from '../utils/sendToSentry' import CompiledQueryCache from './CompiledQueryCache' import getDataLoader from './getDataLoader' import getRateLimiter from './getRateLimiter' @@ -59,10 +60,9 @@ const executeGraphQL = async (req: GQLRequest) => { response = {errors: [new Error(message)] as any} } } - if (!__PRODUCTION__ && response.errors) { + if (response.errors) { const [firstError] = response.errors - console.log((firstError as Error).stack) - console.trace({error: JSON.stringify(response)}) + sendToSentry(firstError as Error) } dataLoader.dispose() return response diff --git a/packages/server/graphql/handleGraphQLTrebuchetRequest.ts b/packages/server/graphql/handleGraphQLTrebuchetRequest.ts index 51fdc7b9bd1..3721f51805d 100644 --- a/packages/server/graphql/handleGraphQLTrebuchetRequest.ts +++ b/packages/server/graphql/handleGraphQLTrebuchetRequest.ts @@ -49,12 +49,6 @@ const handleGraphQLTrebuchetRequest = async ( ip, carrier }) - if (result.errors?.[0]) { - const [firstError] = result.errors - const safeError = new Error(firstError.message) - safeError.stack = firstError.stack - sendToSentry(safeError) - } const safeResult = sanitizeGraphQLErrors(result) // TODO if multiple results, send GQL_DATA for all but the last const messageType = result.data ? 'complete' : 'error' diff --git a/packages/server/graphql/public/mutations/startCheckIn.ts b/packages/server/graphql/public/mutations/startCheckIn.ts index a832930b505..6fe86b06f0a 100644 --- a/packages/server/graphql/public/mutations/startCheckIn.ts +++ b/packages/server/graphql/public/mutations/startCheckIn.ts @@ -91,11 +91,12 @@ const startCheckIn: MutationResolvers['startCheckIn'] = async ( .run(), updateTeamByTeamId(updates, teamId), r.table('AgendaItem').getAll(r.args(agendaItemIds)).update({meetingId}).run(), - getKysely() - .updateTable('AgendaItem') - .set({meetingId}) - .where('id', 'in', agendaItemIds) - .execute() + agendaItemIds.length && + getKysely() + .updateTable('AgendaItem') + .set({meetingId}) + .where('id', 'in', agendaItemIds) + .execute() ]) IntegrationNotifier.startMeeting(dataLoader, meetingId, teamId) analytics.meetingStarted(viewer, meeting) diff --git a/packages/server/utils/sendToSentry.ts b/packages/server/utils/sendToSentry.ts index 252a6e11719..1403cee2c96 100644 --- a/packages/server/utils/sendToSentry.ts +++ b/packages/server/utils/sendToSentry.ts @@ -13,12 +13,7 @@ export interface SentryOptions { // Even though this is a promise we'll never need to await it, so we'll never need to worry about catching an error const sendToSentry = async (error: Error, options: SentryOptions = {}) => { - console.trace( - 'SEND TO SENTRY', - error.message || error?.toString() || JSON.stringify(error), - JSON.stringify(options.tags), - JSON.stringify(options.extras) - ) + console.log('SEND TO SENTRY', error || JSON.stringify(error)) const {sampleRate, tags, extras, userId, ip} = options if (sampleRate && Math.random() > sampleRate) return const fullUser = userId ? await getUserById(userId) : null