From 000bec472ea37261cecf12f1b2f554683d782950 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sat, 15 Aug 2026 18:01:19 -0700 Subject: [PATCH] fix(workflow): derive the webhook URL only where a sub-block shows one `sub-block.tsx` mounts `useWebhookManagement` for every sub-block in the editor panel, and `getBaseUrl()` throws when NEXT_PUBLIC_APP_URL reads empty, so a missing deployment value took down the whole workflow route instead of the one webhook field. The hook already gates its query and store writes on `useWebhookUrl`; the URL now agrees. --- apps/sim/hooks/use-webhook-management.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/sim/hooks/use-webhook-management.ts b/apps/sim/hooks/use-webhook-management.ts index 9b03b378b3b..65586d58cca 100644 --- a/apps/sim/hooks/use-webhook-management.ts +++ b/apps/sim/hooks/use-webhook-management.ts @@ -100,13 +100,24 @@ export function useWebhookManagement({ useCallback((state) => state.getValue(blockId, 'triggerPath') as string | null, [blockId]) ) + /** + * Derived only when the caller actually renders the URL. `getBaseUrl()` throws + * when `NEXT_PUBLIC_APP_URL` is unset, and `sub-block.tsx` mounts this hook for + * every sub-block in the editor panel — deriving the URL unconditionally turns + * a missing deployment value into a render throw for fields that never display + * one, taking down the whole editor instead of the single webhook field. + * Consumers already gate their reads on `useWebhookUrl`. + */ const webhookUrl = useMemo(() => { + if (!useWebhookUrl) { + return '' + } const baseUrl = getBaseUrl() if (!webhookPath) { return `${baseUrl}/api/webhooks/trigger/${blockId}` } return `${baseUrl}/api/webhooks/trigger/${webhookPath}` - }, [webhookPath, blockId]) + }, [useWebhookUrl, webhookPath, blockId]) useEffect(() => { if (triggerId && !isPreview) {