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

ContainerImage.fromAsset in new asset system after 1.45 #8540

Closed
hoegertn opened this issue Jun 14, 2020 · 1 comment · Fixed by #8575
Closed

ContainerImage.fromAsset in new asset system after 1.45 #8540

hoegertn opened this issue Jun 14, 2020 · 1 comment · Fixed by #8575
Assignees
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@hoegertn
Copy link
Contributor

When using ContainerImage.fromAsset the generated CFN template looks like this:

            "Image": {
              "Fn::Sub": {
                "Fn::Join": [
                  "",
                  [
                    "<id>.dkr.ecr.eu-central-1.",
                    {
                      "Ref": "AWS::URLSuffix"
                    },
                    "/cdk-<my-asset-ecr>:<hash>"
                  ]
                ]
              }
            },

This is invalid CloudFormation as Join is not valid inside Sub:

E1019 Sub should be a string or array of 2 items for Resources/TaskDef3BF4F22B/Properties/ContainerDefinitions/0/Image/Fn::Sub

The problem might be here https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts#L281 as it creates an Fn::Sub containing an Fn::Join which is not valid.

@rix0rrr see #3463 (comment)

Reproduction Steps

Use any ContainerImage.fromAsset

Environment

  • CLI Version : 1.45.0
  • Framework Version: 1.45.0
  • Node.js Version: v14
  • OS : MacOS
  • Language (Version): TypeScript

This is 🐛 Bug Report

@hoegertn hoegertn added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 14, 2020
@agdimech
Copy link

+1 - Confirm this is happening for me also.

rix0rrr added a commit that referenced this issue Jun 16, 2020
When referencing loations that contained unresolved Tokens (
account, region, URL suffix) the synthesizer generated:

    {Fn::Sub: { Fn::Join: ... }}

That is not allowed, the first argument to `{Fn::Sub}` must be a string
literal.

This was a problem for all asset types, but the most-used file asset
(`lambda.Code`) would only render `{ bucketName, objectKey }` which
typically don't contain tokens, so you'd only notice when using
Docker image assets.

Fixes #8540.
@mergify mergify bot closed this as completed in #8575 Jun 17, 2020
mergify bot pushed a commit that referenced this issue Jun 17, 2020
When referencing loations that contained unresolved Tokens (
account, region, URL suffix) the synthesizer generated:

    {Fn::Sub: { Fn::Join: ... }}

That is not allowed, the first argument to `{Fn::Sub}` must be a string
literal.

This was a problem for all asset types, but the most-used file asset
(`lambda.Code`) would only render `{ bucketName, objectKey }` which
typically don't contain tokens, so you'd only notice when using
Docker image assets.

Fixes #8540.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants