fix: unwrap webhook payload before test and resend

This commit is contained in:
ephraimduncan 2026-04-20 13:08:26 +00:00
parent 198dafc8ec
commit 01c68a63f2
No known key found for this signature in database
GPG key ID: EA98563B876B2CD8
2 changed files with 11 additions and 2 deletions

View file

@ -32,7 +32,7 @@ export const triggerTestWebhook = async ({
try {
await triggerWebhook({
event,
data: samplePayload,
data: samplePayload.payload,
userId,
teamId,
});

View file

@ -39,12 +39,21 @@ export const resendWebhookCallRoute = authenticatedProcedure
throw new AppError(AppErrorCode.NOT_FOUND);
}
const requestBody = webhookCall.requestBody;
const data =
requestBody &&
typeof requestBody === 'object' &&
!Array.isArray(requestBody) &&
'payload' in requestBody
? requestBody.payload
: requestBody;
await jobs.triggerJob({
name: 'internal.execute-webhook',
payload: {
event: webhookCall.event,
webhookId,
data: webhookCall.requestBody,
data,
},
});
});