MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / logWebhook

Function logWebhook

apps/web/src/app/api/webhooks/gitlab/route.ts:86–116  ·  view source on GitHub ↗
(action: string)

Source from the content-addressed store, hash-verified

84
85 // 6. Helper function to log webhook events
86 const logWebhook = async (action: string) => {
87 try {
88 // Determine owner from integration
89 const owner = integration.owned_by_organization_id
90 ? { type: 'org' as const, id: integration.owned_by_organization_id }
91 : ({ type: 'user' as const, id: integration.owned_by_user_id } as Owner);
92
93 const { event, isDuplicate } = await logWebhookEvent({
94 owner,
95 platform: PLATFORM.GITLAB,
96 event_type: eventType,
97 event_action: action,
98 payload,
99 headers,
100 event_signature: eventSignature,
101 });
102
103 if (isDuplicate) {
104 logExceptInTest('Duplicate webhook event detected');
105 return { isDuplicate: true, webhookEvent: event };
106 }
107 return { isDuplicate: false, webhookEvent: event };
108 } catch (error) {
109 logExceptInTest('Error logging webhook event:', error);
110 captureException(error, {
111 tags: { source: 'gitlab_webhook_event_logging' },
112 extra: { event_type: eventType, event_action: action },
113 });
114 return { isDuplicate: false, webhookEvent: undefined };
115 }
116 };
117
118 // 7. Route based on event type
119

Callers 1

POSTFunction · 0.70

Calls 1

logWebhookEventFunction · 0.90

Tested by

no test coverage detected