From d5455d7accb193078b05a0f52386cf9303b6a00f Mon Sep 17 00:00:00 2001 From: Omar Ajoue Date: Wed, 17 Jan 2024 12:08:20 +0000 Subject: [PATCH] fix(core): Report when waitTill is invalid and handle it (#8356) --- packages/cli/src/WaitTracker.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/cli/src/WaitTracker.ts b/packages/cli/src/WaitTracker.ts index 435b6f5b949f9..b39222bc639bc 100644 --- a/packages/cli/src/WaitTracker.ts +++ b/packages/cli/src/WaitTracker.ts @@ -53,6 +53,21 @@ export class WaitTracker { for (const execution of executions) { const executionId = execution.id; if (this.waitingExecutions[executionId] === undefined) { + if (!(execution.waitTill instanceof Date)) { + // n8n expects waitTill to be a date object + // but for some reason it's not being converted + // we are handling this like this since it seems to address the issue + // for some users, as reported by Jon when using a custom image. + // Once we figure out why this it not a Date object, we can remove this. + ErrorReporter.error('Wait Till is not a date object', { + extra: { + variableType: typeof execution.waitTill, + }, + }); + if (typeof execution.waitTill === 'string') { + execution.waitTill = new Date(execution.waitTill); + } + } const triggerTime = execution.waitTill!.getTime() - new Date().getTime(); this.waitingExecutions[executionId] = { executionId,