Skip to content

Commit edfdc16

Browse files
TheodoreSpeaksTheodore Li
andcommitted
fix(webhook): throw webhook errors as 4xxs (#4050)
* fix(webhook): throw webhook errors as 4xxs * Fix shadowing body var --------- Co-authored-by: Theodore Li <theo@sim.ai>
1 parent 90535f1 commit edfdc16

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

apps/sim/lib/webhooks/processor.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,15 @@ export async function processPolledWebhookEvent(
725725
try {
726726
const preprocessResult = await checkWebhookPreprocessing(foundWorkflow, foundWebhook, requestId)
727727
if (preprocessResult.error) {
728-
return { success: false, error: 'Preprocessing failed', statusCode: 500 }
728+
const errorResponse = preprocessResult.error
729+
const statusCode = errorResponse.status
730+
const errorBody = await errorResponse.json().catch(() => ({}))
731+
const errorMessage = errorBody.error ?? 'Preprocessing failed'
732+
logger.warn(`[${requestId}] Polled webhook preprocessing failed`, {
733+
statusCode,
734+
error: errorMessage,
735+
})
736+
return { success: false, error: errorMessage, statusCode }
729737
}
730738

731739
if (foundWebhook.blockId) {

0 commit comments

Comments
 (0)