Squash the oldRow variable to avoid issues when serialising. Added a try/catch when queuing automations in dev

This commit is contained in:
Dean 2024-07-04 12:13:58 +01:00
parent 9ba415878e
commit a4a472b2d8
2 changed files with 18 additions and 6 deletions

View File

@ -72,15 +72,23 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
const row = await sdk.rows.external.getRow(tableId, updatedId, {
relationships: true,
})
const enrichedRow = await outputProcessing(table, row, {
squash: true,
preserveLinks: true,
})
const [enrichedRow, oldRow] = await Promise.all([
outputProcessing(table, row, {
squash: true,
preserveLinks: true,
}),
outputProcessing(table, beforeRow, {
squash: true,
preserveLinks: true,
}),
])
return {
...response,
row: enrichedRow,
table,
oldRow: beforeRow,
oldRow,
}
}

View File

@ -66,7 +66,11 @@ async function queueRelevantRowAutomations(
automationTrigger?.inputs &&
automationTrigger.inputs.tableId === event.row.tableId
) {
await automationQueue.add({ automation, event }, JOB_OPTS)
try {
await automationQueue.add({ automation, event }, JOB_OPTS)
} catch (e) {
console.error("Failed to queue automation", e)
}
}
}
})