Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid InvalidPhysicalResourceId for incorrectly configured src=DockerImageAsset #213

Open
athewsey opened this issue Sep 27, 2022 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@athewsey
Copy link

Confession time: Today I was bad at reading the docs and paid the price...

I tried something along the lines of (in Python CDK):

from aws_cdk.aws_ecr_assets import DockerImageAsset
from cdk_ecr_deployment import ECRDeployment, DockerImageName

image = DockerImageAsset(
    self,
    "Image",
    directory="/home/CoolestPersonAlive/etc/container",
    ...,
)
deployment = ECRDeployment(
    self,
    "Deployment",
    src=image,
    dest=DockerImageName(destination_ecr_uri),
)

As diligent students of the readme will know already, I should've instead had src=DockerImageName(image.image_uri). The above breaks.

But, I'm raising this because it broke in a difficult-to-diagnose way: The synthesis completed and started CloudFormation deployment, to ultimately fail with a cryptic "Invalid PhysicalResourceId" message. It took some time and Google-fu to realise I needed to:

  • Try cdk deploy again with --no-rollback to avoid obliterating the part-built resources
  • Figure out which Lambda in my account was backing that particular custom resource based on the LogicalResourceId (this is a complex stack, so there was a bit of searching to do)
  • Open the CloudWatch logs and find the2022/09/27 15:10:27 sending status failed: can't get SrcImage message hinting that something was up with the src configuration.

It feels like this was a pretty easy mistake to make, so 2 questions:

  1. Could this construct maybe be extended to handle DockerImageAsset inputs directly & correctly?
  2. Regardless, would it be possible to make the error handling a bit more informative here? Ideal if it could fail earlier in the process, but even a more understandable error later on would be useful!
@mrgrain mrgrain added enhancement New feature or request help wanted Extra attention is needed labels Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants