Skip to content

Commit

Permalink
chore: Refactor Slack bot logging for improved debugging (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhaufe authored Jul 30, 2024
1 parent a77d5e0 commit 77b8b50
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions server/api/slack-bot/index.post.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { z } from "zod"
import crypto from 'crypto'
import { WebClient } from "@slack/web-api"
import appInsights from 'applicationinsights';

const ai = appInsights.defaultClient

const bodySchema = z.object({
type: z.string(),
Expand Down Expand Up @@ -101,14 +98,8 @@ export default defineEventHandler(async (event) => {
message: JSON.stringify(body.error.errors)
})

ai.trackTrace({
message: `SlackBotMessage Headers: ${JSON.stringify(headers)}`
})
ai.trackTrace({
message: `SlackBotMessage rawBody: ${rawBody}`
})

ai.flush()
console.log('SlackBotMessage Headers:', JSON.stringify(headers))
console.log('SlackBotMessage rawBody:', { rawBody })

if (!isValidSlackRequest(headers, rawBody))
throw createError({
Expand Down

0 comments on commit 77b8b50

Please sign in to comment.