question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(pipelines): Need a way to get Stack Outputs as file artifact if they are > 1000 chars

See original GitHub issue

What is the problem?

It looks like CodeBuildStep.envFromCfnOutputs property is limited to 1-1000 characters. When injecting variables, it can quickly reaches this limit and the CodePipeline build fails with:

8:35:20 AM | CREATE_FAILED        | AWS::CodePipeline::Pipeline                  | ##############
ActionConfiguration Map value must satisfy constraint: [Member must have length less than or equal to 1000, Member must have length greater than or equal to 1] (Service: AWSCodePipeline; Status Code: 400; Error Code: ValidationException; Request ID: ############; Proxy: null)

Reproduction Steps

Include many environment variables from CloudFormation output in CodeBuildStep.envFromCfnOutputs.

What did you expect to happen?

CodeBuildStep successful.

What actually happened?

CodeBuildStep failure with too vague error message.

CDK CLI Version

1.127.0

Framework Version

No response

Node.js Version

14.x

OS

macOS 11.6

Language

Typescript

Language Version

No response

Other information

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
piotrekwitkowskicommented, May 18, 2022

I use the following workaround:

CodeBuildStep('StepId',
    commands=[
        'aws sts get-caller-identity', # you don't need this but it prints out the role for debugging purposes
        'export MY_VAR=$(aws cloudformation describe-stacks --query "Stacks[?StackName==\'stack-name\'][].Outputs[?OutputKey==\'my-output-key\'].OutputValue" --output text)',
        'echo $MY_VAR'
    ],
    role_policy_statements=[
        PolicyStatement(
            actions=['cloudFormation:DescribeStacks'],
            resources=['*'],
        ),
    ]
)
1reaction
brennadotdevcommented, Oct 22, 2021

I’ve run in to this as well, but only in one specific AWS account. I use the same CDK code in other accounts and it works as expected. I’m not sure what the difference is yet since they all have the same number of variables in the build step and reference SSM params of the same names.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Input and output artifacts - AWS CodePipeline
The pipeline can function normally. This is not an issue with the folder or artifacts. There is a 100-character limit to pipeline names....
Read more >
Job artifacts - GitLab Docs
Jobs can output an archive of files and directories. This output is known as a job artifact. You can download job artifacts by...
Read more >
Troubleshooting AWS CodePipeline Artifacts - Stelligent
When you use the CLI, SDK, or CloudFormation to create a pipeline in ... Figure 1 shows an encrypted CodePipeline Artifact zip file...
Read more >
How to work around Cfn action's character limit in CodePipeline
I got some assistance from a CDK maintainer here, which let me get well under the 1000-character limit. Reproducing the workaround here:.
Read more >
Amazon CodeBuild - Amazon CodePipeline - 亚马逊云科技
Description: These can be used to make the artifacts that are defined in the CodeBuild build spec file available to subsequent actions in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found