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:
Lucas Smith
2025-11-08 00:48:13 +11:00
committed by GitHub
parent 3d539b20ad
commit db5524f8ce

View File

@ -189,9 +189,11 @@ export const run = async ({
settings,
});
const newDocumentData = await Promise.all(
envelopeItems.map(async (envelopeItem) =>
io.runTask(`decorate-${envelopeItem.id}`, async () => {
const decoratePromises: Array<Promise<{ oldDocumentDataId: string; newDocumentDataId: string }>> =
[];
for (const envelopeItem of envelopeItems) {
const task = io.runTask(`decorate-${envelopeItem.id}`, async () => {
const envelopeItemFields = envelope.envelopeItems.find(
(item) => item.id === envelopeItem.id,
)?.field;
@ -209,9 +211,12 @@ export const run = async ({
certificateData,
auditLogData,
});
}),
),
);
});
decoratePromises.push(task);
}
const newDocumentData = await Promise.all(decoratePromises);
const postHog = PostHogServerClient();