Skip to content

Commit

Permalink
replaced appInsights call with filesystem log call (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhaufe authored Jul 30, 2024
1 parent 65ee15a commit d5ffa8b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions server/api/slack-bot/index.post.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { z } from "zod"
import crypto from 'crypto'
import { WebClient } from "@slack/web-api"
import appInsights from '../../appInsights'

const ai = appInsights.defaultClient;
import fs from 'fs';

const bodySchema = z.object({
type: z.string(),
Expand Down Expand Up @@ -94,12 +92,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
})
fs.appendFileSync('/log/slackbot.log', `SlackBotMessage Headers: ${JSON.stringify(headers)}\n`);
fs.appendFileSync('/slack-bot/slackbot.log', `SlackBotMessage rawBody: ${rawBody}\n`);

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

0 comments on commit d5ffa8b

Please sign in to comment.