aws / aws/aws-cdk

(aws-stepfunctions-tasks): (Batch SubmitJob automatically adds a containerOverrides even with an ECS multi container Batch )

Open
#36,273 1 comment 0 reactions 1 assignee Claimed by @pahud View on GitHub
@aws-cdk/aws-stepfunctions-tasks bug cause/not-a-bug p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Considering an AWS batch job definition that defines two containers within ecsProperties:

```typescript
const jobDefinition = new CfnJobDefinition(scope, `job-definition-${name}`, {
containerProperties: {
ecsProperties: {
....
}
}
})
```

We try to launch that job throught AWS step function:

```typscript
const batchJobTask = new tasks.BatchSubmitJob(scope, `${app}-${name}-job-task`, {
jobName: `${app}-${name}-job`,
...
stateName: 'ExecuteBatchJob',
});
````

Step function will fails with the following error : `Container overrides should not be set for ecsProperties jobs. (Service: AWSBatch; Status Code: 400; Error Code: ClientException; Request ID: 36d5ba3a-466d-4ed8-b559-7a3193c0970b; Proxy: null)`

It seems that AWS Step function automatically adds this bloc in the batch definition:

```json
"ContainerOverrides":{
"Environment": [
{
"Name": "MANAGED_BY_AWS",
"Value": "STARTED_BY_STEP_FUNCTIONS"
}
]
}
```
But ContainerOverrides seems incompatibale with a job that uses EcsProperties, making the Step failing.

Another example of user having the same issue: https://repost.aws/questions/QUYUtrKcPGRf-Rj1m1dXJH1Q/aws-batch-running-ecsproperties-job-with-aws-stepfunction

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

The BatchSubmitJob should work with AWS Batch jobs that define ecsProperties

### Current Behavior

The BatchSubmitJob doesn't work with AWS Batch jobs that define ecsProperties

### Reproduction Steps

-

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

2.212.0

### AWS CDK CLI version

2.1020.0

### Node.js Version

22

### OS

Windows

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.