mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 18:04:55 +10:00
fix: resolve issue with sealing task on inngest (#2146)
Currently on inngest the sealing task fails during decoration stating that it can not find the step "xxx" My running theory is that this was due to it being a Promise.all(map(...)) even though that isn't explicitly disallowed. This change turns it into a for loop collecting promises to be awaited after the fact. Local inngest testing looks promising.
This commit is contained in:
@@ -189,29 +189,34 @@ export const run = async ({
|
|||||||
settings,
|
settings,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newDocumentData = await Promise.all(
|
const decoratePromises: Array<Promise<{ oldDocumentDataId: string; newDocumentDataId: string }>> =
|
||||||
envelopeItems.map(async (envelopeItem) =>
|
[];
|
||||||
io.runTask(`decorate-${envelopeItem.id}`, async () => {
|
|
||||||
const envelopeItemFields = envelope.envelopeItems.find(
|
|
||||||
(item) => item.id === envelopeItem.id,
|
|
||||||
)?.field;
|
|
||||||
|
|
||||||
if (!envelopeItemFields) {
|
for (const envelopeItem of envelopeItems) {
|
||||||
throw new Error(`Envelope item fields not found for envelope item ${envelopeItem.id}`);
|
const task = io.runTask(`decorate-${envelopeItem.id}`, async () => {
|
||||||
}
|
const envelopeItemFields = envelope.envelopeItems.find(
|
||||||
|
(item) => item.id === envelopeItem.id,
|
||||||
|
)?.field;
|
||||||
|
|
||||||
return decorateAndSignPdf({
|
if (!envelopeItemFields) {
|
||||||
envelope,
|
throw new Error(`Envelope item fields not found for envelope item ${envelopeItem.id}`);
|
||||||
envelopeItem,
|
}
|
||||||
envelopeItemFields,
|
|
||||||
isRejected,
|
return decorateAndSignPdf({
|
||||||
rejectionReason,
|
envelope,
|
||||||
certificateData,
|
envelopeItem,
|
||||||
auditLogData,
|
envelopeItemFields,
|
||||||
});
|
isRejected,
|
||||||
}),
|
rejectionReason,
|
||||||
),
|
certificateData,
|
||||||
);
|
auditLogData,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
decoratePromises.push(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
const newDocumentData = await Promise.all(decoratePromises);
|
||||||
|
|
||||||
const postHog = PostHogServerClient();
|
const postHog = PostHogServerClient();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user