mirror of
https://github.com/documenso/documenso.git
synced 2026-07-24 17:04:12 +10:00
fix: unwrap webhook payload before test and resend (#2710)
This commit is contained in:
@@ -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,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user