WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 2a00e72

Browse files
authored
fix(webhooks): move webhook acknowledge config to cover early deserialization errors (#9508)
1 parent 36b0579 commit 2a00e72

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

crates/router/src/core/webhooks/incoming.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
226226

227227
// Determine webhook processing path (UCS vs non-UCS) and handle event type extraction
228228
let webhook_processing_result =
229-
if unified_connector_service::should_call_unified_connector_service_for_webhooks(
229+
match if unified_connector_service::should_call_unified_connector_service_for_webhooks(
230230
&state,
231231
&merchant_context,
232232
&connector_name,
@@ -245,7 +245,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
245245
&request_details,
246246
merchant_connector_account.as_ref(),
247247
)
248-
.await?
248+
.await
249249
} else {
250250
// NON-UCS PATH: Need to decode body first
251251
let decoded_body = connector
@@ -268,7 +268,23 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
268268
decoded_body.into(),
269269
&request_details,
270270
)
271-
.await?
271+
.await
272+
} {
273+
Ok(result) => result,
274+
Err(error) => {
275+
let error_result = handle_incoming_webhook_error(
276+
error,
277+
&connector,
278+
connector_name.as_str(),
279+
&request_details,
280+
);
281+
match error_result {
282+
Ok((response, webhook_tracker, serialized_request)) => {
283+
return Ok((response, webhook_tracker, serialized_request));
284+
}
285+
Err(e) => return Err(e),
286+
}
287+
}
272288
};
273289

274290
// if it is a setup webhook event, return ok status

0 commit comments

Comments
 (0)