batch: EksContainerDefinition image from ECR raises RuntimeError: Cannot read property 'obtainExecutionRole' of undefined
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
When specifying EKS task in batch module like this:
```
container_definition = batch.EksContainerDefinition(
self,
f"foo",
image=ecs.ContainerImage.from_ecr_repository(
repository, image_tag
),
image_pull_policy=batch.ImagePullPolicy.ALWAYS,
volumes=[
batch.EksVolume.empty_dir(
name="myEmptyDirVolume",
mount_path="/mount/path",
medium=batch.EmptyDirMediumType.MEMORY,
readonly=True,
size_limit=Size.mebibytes(2048),
)
],
)
```
part `ecs.ContainerImage.from_ecr_repository` raises `RuntimeError: Cannot read property 'obtainExecutionRole' of undefined`.
CDK version: CDK_CLI_VERSION: '2.115.0', Python
### Expected Behavior
Image is successfully set
### Current Behavior
```
RuntimeError: Cannot read property 'obtainExecutionRole' of undefined
```
### Reproduction Steps
Run CDK synth with the code above
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.115.0 (build 58027ee)
### Framework Version
_No response_
### Node.js Version
v16.0.0
### OS
Amazon Linux
### Language
Python
### Language Version
3.11
### Other information
_No response_
Contributor guide
Research direction
Start with the EksContainerDefinition entry point and ecs.ContainerImage.from_ecr_repository, then run CDK synth with the reproduction shown in the issue. Trace the failing obtainExecutionRole call and verify that the image is successfully set without the RuntimeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, typescript
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100