mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
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>
This commit is contained in:
@@ -725,7 +725,15 @@ export async function processPolledWebhookEvent(
|
||||
try {
|
||||
const preprocessResult = await checkWebhookPreprocessing(foundWorkflow, foundWebhook, requestId)
|
||||
if (preprocessResult.error) {
|
||||
return { success: false, error: 'Preprocessing failed', statusCode: 500 }
|
||||
const errorResponse = preprocessResult.error
|
||||
const statusCode = errorResponse.status
|
||||
const errorBody = await errorResponse.json().catch(() => ({}))
|
||||
const errorMessage = errorBody.error ?? 'Preprocessing failed'
|
||||
logger.warn(`[${requestId}] Polled webhook preprocessing failed`, {
|
||||
statusCode,
|
||||
error: errorMessage,
|
||||
})
|
||||
return { success: false, error: errorMessage, statusCode }
|
||||
}
|
||||
|
||||
if (foundWebhook.blockId) {
|
||||
|
||||
Reference in New Issue
Block a user