MCPcopy Index your code
hub / github.com/simstudioai/sim / cleanupExternalWebhook

Function cleanupExternalWebhook

apps/sim/lib/webhooks/provider-subscriptions.ts:125–150  ·  view source on GitHub ↗
(
  webhook: Record<string, unknown>,
  workflow: Record<string, unknown>,
  requestId: string,
  options: { throwOnError?: boolean } = {}
)

Source from the content-addressed store, hash-verified

123 * Deployment outbox cleanup passes `throwOnError` so provider failures stay retryable.
124 */
125export async function cleanupExternalWebhook(
126 webhook: Record<string, unknown>,
127 workflow: Record<string, unknown>,
128 requestId: string,
129 options: { throwOnError?: boolean } = {}
130): Promise<void> {
131 const provider = webhook.provider as string
132 const handler = getProviderHandler(provider)
133
134 if (!handler.deleteSubscription) {
135 return
136 }
137
138 try {
139 await handler.deleteSubscription({ webhook, workflow, requestId, strict: options.throwOnError })
140 } catch (error) {
141 logger.warn(`[${requestId}] Error cleaning up external webhook (non-fatal)`, {
142 provider,
143 webhookId: webhook.id,
144 error: toError(error).message,
145 })
146 if (options.throwOnError) {
147 throw error
148 }
149 }
150}

Callers 6

route.tsFile · 0.90
route.tsFile · 0.90

Calls 4

getProviderHandlerFunction · 0.90
toErrorFunction · 0.90
deleteSubscriptionMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected