From 6c58f330f8bac173780f163eb5cace665bbaf8ac Mon Sep 17 00:00:00 2001 From: dal Date: Fri, 11 Jul 2025 16:49:18 -0600 Subject: [PATCH 1/2] slack events endpoint hotfix --- apps/server/src/api/v2/slack/index.ts | 34 ++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/apps/server/src/api/v2/slack/index.ts b/apps/server/src/api/v2/slack/index.ts index 37f70a8a9..bfd8e6bc1 100644 --- a/apps/server/src/api/v2/slack/index.ts +++ b/apps/server/src/api/v2/slack/index.ts @@ -16,9 +16,37 @@ const app = new Hono() .delete('/integration', requireAuth, (c) => slackHandler.removeIntegration(c)) // Events endpoint (no auth required for Slack webhooks) .post('/events', async (c) => { - const body = await c.req.json(); - const response = await eventsHandler(body); - return c.json(response); + try { + // Slack sends different content types for different events + // For URL verification, it's application/x-www-form-urlencoded + // For actual events, it's application/json + const contentType = c.req.header('content-type'); + + if (contentType?.includes('application/x-www-form-urlencoded')) { + // Handle URL verification challenge + const formData = await c.req.parseBody(); + if (formData.challenge) { + return c.text(formData.challenge as string); + } + } + + // For JSON payloads, try to parse but don't fail + let body = null; + if (contentType?.includes('application/json')) { + try { + body = await c.req.json(); + } catch { + // If JSON parsing fails, just continue + } + } + + const response = await eventsHandler(body); + return c.json(response); + } catch (error) { + // Log the error but always return 200 OK for Slack + console.error('Error processing Slack event:', error); + return c.json({ success: true }); + } }) // Error handling .onError((e, c) => { From ad1dda4fa4e3933a334715d091d02222d5832834 Mon Sep 17 00:00:00 2001 From: dal Date: Fri, 11 Jul 2025 16:51:59 -0600 Subject: [PATCH 2/2] build fix --- apps/web/src/mocks/metricData.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/src/mocks/metricData.ts b/apps/web/src/mocks/metricData.ts index c8e097ef0..5809faf8c 100644 --- a/apps/web/src/mocks/metricData.ts +++ b/apps/web/src/mocks/metricData.ts @@ -62,7 +62,8 @@ const dataMetadata: DataMetadata = { const MOCK_DATA: Required = { data: mockData(), metricId: 'mock-metric-1', - data_metadata: dataMetadata + data_metadata: dataMetadata, + has_more_records: false }; export const createMockData = (metricId: string): Required => {