From 7437946b6c243daa749a1dd6455299f707500f25 Mon Sep 17 00:00:00 2001 From: kaizen3031593 Date: Fri, 25 Mar 2022 15:13:23 -0400 Subject: [PATCH] fix timeout --- .../lib/batch/submit-job.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts index 4d32a57613961..d795b9f62f5e2 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts @@ -191,18 +191,17 @@ export class BatchSubmitJob extends sfn.TaskStateBase { }); // validate timeout - props.timeout !== undefined && withResolved(props.timeout.toSeconds(), (timeout) => { - if (timeout < 60) { - throw new Error(`attempt duration must be greater than 60 seconds. Received ${timeout} seconds.`); - } - }); + if (props.timeout !== undefined && !props.timeout.isUnresolved() && props.timeout.toSeconds() < 60) { + throw new Error(`attempt duration must be at least 60 seconds. Received ${props.timeout} seconds.`); + } // validate memory - props.containerOverrides?.memory !== undefined && withResolved(props.containerOverrides.memory.toMebibytes(), (memory) => { - if (memory < 4) { - throw new Error('memory must be at least 4MiB'); - } - }); + if (props.containerOverrides?.memory !== undefined && + !props.containerOverrides.memory.isUnresolved() && + props.containerOverrides.memory.toMebibytes() < 4) { + throw new Error('memory must be at least 4MiB'); + } + // This is required since environment variables must not start with AWS_BATCH; // this naming convention is reserved for variables that are set by the AWS Batch service.