aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

`cloudformation package` not handling `CodeS3Location` on AppSync Resolvers and FunctionConfigurations

Open chrisb-cd opened this issue 3 years ago • 9 comments

Describe the bug

cloudformation package does not properly handle artifact create for AWS::AppSync::Resolver and AWS::AppSync::FunctionConfiguration CodeS3Location properties

Expected Behavior

Artifacts are uploaded to S3 bucket and the template returned by package has the property values updated to the S3 references.

Current Behavior

No artifacts are uploaded for these properties and the template returned by package is not updated.

Reproduction Steps

Package the following template and notice that the package template is identical and nothing was uplaoded to the S3 bucket

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "BugResolver": {
        "Type": "AWS::AppSync::Resolver",
        "Properties": {
            "CodeS3Location": "./resolver.json"
        }
    },
    "BugFunction": {
        "Type": "AWS::AppSync::FunctionConfiguration",
        "Properties": {
            "CodeS3Location": "./function.js"
        }
    }
}

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.9.0

Environment details (OS name and version, etc.)

Python/3.11.0 Darwin/21.6.0 source/arm64 prompt/off

chrisb-cd avatar Nov 23 '22 01:11 chrisb-cd

Thanks @chrisb-cd for reporting this issue and creating that PR. Changes related to the CloudFormation customization are currently not prioritized so I'm not sure when the team will have a chance to look into this further. Are you able to use the SAM CLI as an alternative or do you know if this issue present there as well?

tim-finnigan avatar Nov 23 '22 18:11 tim-finnigan

@tim-finnigan sam exhibits the same issue.

chrisb-cd avatar Nov 23 '22 18:11 chrisb-cd

@tim-finnigan It is unfortunate that this is not being prioritized at the moment. It hamstrings a very useful new feature that AWS just launched. It is just a question of it not being prioritized in the CLI and there is a better place to have this fixed?

chrisb-cd avatar Nov 24 '22 00:11 chrisb-cd

Thanks @chrisb-cd ! I am facing the same issue. Until this is updated, I am inlining the JS code using the Code property of the AWS::AppSync::FunctionConfiguration resource in the template.

firelike avatar Nov 30 '22 00:11 firelike

Thanks @chrisb-cd ! I am facing the same issue. Until this is updated, I am inlining the JS code using the Code property of the AWS::AppSync::FunctionConfiguration resource in the template.

@firelike That certainly is an option. For our project we switched to Velocity Mapping Templates which have S3Location properties that are handled properly.

chrisb-cd avatar Nov 30 '22 15:11 chrisb-cd

@tim-finnigan has there been any progress on this front? As @chrisb-cd mentioned, this effects the ability to use AWS::AppSync::FunctionConfiguration for all javascript pipeline resolver functions. The behavior of CodeS3Location is inconsistent with the behavior of other appsync resources which do accept relative paths, like DefinitionS3Location, and also as @chrisb-cd noted, it is also inconsistent with the VTL pipeline implementation.

Like @firelike my team is also currently inlining our functions for the time being, but it seems like these could quickly get out of hand and balloon templates enormously.

trevorbennett avatar Mar 15 '23 16:03 trevorbennett

For those using SAM, aws-sam-cli resolved this issue in version 1.68.0, here is the associated pull request for those curious:

https://github.com/aws/aws-sam-cli/pull/4463

trevorbennett avatar Mar 24 '23 16:03 trevorbennett

Thanks for following up and sharing that PR. We don't have any updates on this issue, but encourage others to add a 👍 to the issue to help the team with assessing demand and priority. In the meantime you could use the SAM CLI/sam package command for this use case.

tim-finnigan avatar Mar 24 '23 19:03 tim-finnigan

I just built a cloudformation template and inlined everything, hoping to use the cloudformation package feature once I have a prototype. It's a little demoralising having to now learn what SAM is, just to get this working when someone has even been kind enough to raise a PR to fix it.

If this is Amazon's approach to cloudformation package it should have a massive banner on the docs saying "depreacted - no longer maintained".

connelhooley avatar Sep 10 '23 13:09 connelhooley