fix: unwrap webhook payload before test and resend (#2710)

This commit is contained in:
Ephraim Duncan
2026-04-22 05:42:16 +00:00
committed by GitHub
parent d38d703fd3
commit e5da5bca38
3 changed files with 29 additions and 18 deletions
@@ -1,6 +1,7 @@
import { TEAM_MEMBER_ROLE_PERMISSIONS_MAP } from '@documenso/lib/constants/teams';
import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';
import { jobs } from '@documenso/lib/jobs/client';
import { ZWebhookPayloadSchema } from '@documenso/lib/types/webhook-payload';
import { buildTeamWhereQuery } from '@documenso/lib/utils/teams';
import { prisma } from '@documenso/prisma';
@@ -39,12 +40,16 @@ export const resendWebhookCallRoute = authenticatedProcedure
throw new AppError(AppErrorCode.NOT_FOUND);
}
// `requestBody` stores the full delivery envelope; unwrap to the inner
// document so the handler doesn't wrap it a second time.
const { payload: data } = ZWebhookPayloadSchema.parse(webhookCall.requestBody);
await jobs.triggerJob({
name: 'internal.execute-webhook',
payload: {
event: webhookCall.event,
webhookId,
data: webhookCall.requestBody,
data,
},
});
});