aws / aws/aws-cdk-cli

DockerImageAsset: it fails to deploy to 2 regions

Open
#650 10 comments 3 reactions 0 assignees View on GitHub
bug effort/medium p2
Dominant language
TypeScript
Stars
105
Forks
122
Avg merge
1d 17h
Merged PRs (30d)
71

Description

### Describe the bug

I have a CDK stack with DockerImageAsset that I use to deploy to 2 different regions.
The instance of the second stack is not pushed to ECR

### Expected Behavior

The image is present in the ECR of both regions

### Current Behavior

Only the first stack is correctly pushing the image to ECR

### Reproduction Steps

sample-cdk-stack.ts

```ts
import * as cdk from "aws-cdk-lib";
import { DockerImageAsset } from "aws-cdk-lib/aws-ecr-assets";
import { Construct } from "constructs";
import path = require("path");
export class SampleCdkStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

const { env } = props!;

const image = new DockerImageAsset(
this,
`MultiRegionImage-${env?.region}`,
{
directory: path.join(__dirname, ".."),
}
);

new cdk.CfnOutput(this, "ImageUri", {
value: image.imageUri,
});
}
}
```

sample-cdk.ts

```ts
#!/usr/bin/env node
import "source-map-support/register";
import * as cdk from "aws-cdk-lib";
import { SampleCdkStack } from "../lib/sample-cdk-stack";

const app = new cdk.App();

new SampleCdkStack(app, "SampleCdkStackFrankfurt", {
env: { account: "***", region: "eu-central-1" },
});

new SampleCdkStack(app, "SampleCdkStackLondon", {
env: { account: "***", region: "eu-west-2" },
});
```

The DcokerImage can be a simple express application

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.83.1

### Framework Version

_No response_

### Node.js Version

v16.15.1

### OS

macOS Monterey 12.4

### Language

Typescript

### Language Version

~5.0.4

### 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.