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.

(codepipeline): Error: The 'account' property must be a concrete value (action: 'CodeBuild')

See original GitHub issue

I have a CodePipeline pipeline with a GitHub source stage, a build stage which builds a Docker image using CodeBuild, and a deploy stage which deploys the image to ECS Fargate. I’ve been using the CDK to successfully construct quite a few of these similar pipelines recently however I’m now stuck on 1.99.0 as this error started happening in 1.100.0 and I’ve tried each release since then up to the most recent release (1.104.0) and they’re all not working. I’ve had a look at the release notes from 1.100.0 and have had a fiddle but have been unable to figure out what’s going wrong.

My code fails to validate. For example, when I run npx cdk diff --all, I get this error:

C:\path\to\my\project\node_modules\@aws-cdk\aws-codepipeline\lib\pipeline.ts:679
      // For every output artifact, get the producer
              ^
Error: The 'account' property must be a concrete value (action: 'CodeBuild')

Reproduction Steps

I’ve written a reusable function which takes props and creates a CodePipeline pipeline so I’m not sure exactly how to provide minimal reproduction code but here is the function. I’m using it to construct all my deployment pipelines in this project:

export interface BuildDeploymentPipelineProps {
  scope: cdk.Construct,
  id: string,
  envName: string,
  name: string,
  artifactBucket: s3.Bucket,
  gitHub: {
    owner: string,
    repo: string,
    branch: string,
    connectionArn: string,
  },
  codebuildProject: codebuild.Project,
  additionalBuildEnv?: { [name: string]: codebuild.BuildEnvironmentVariable },
  deploymentEcsServices: DeploymentEcsService[],
}

export interface DeploymentEcsService {
  name: string,
  service: ecs.FargateService
}

export const buildDeploymentPipeline = (props: BuildDeploymentPipelineProps): codepipeline.Pipeline => {
  const sourceOutput = new codepipeline.Artifact();
  const buildOutput = new codepipeline.Artifact();
  const deployActions: codepipeline.IAction[] = [];
  props.deploymentEcsServices.forEach((deployService) => {
    deployActions.push(
      new cpActions.EcsDeployAction({
        actionName: 'EcsDeploy' + deployService.name,
        service: deployService.service,
        input: buildOutput
      })
    )
  })
  return new codepipeline.Pipeline(props.scope, props.id, {
    pipelineName: naming.constructCodePipelinePipelineName(props.envName, props.name),
    artifactBucket: props.artifactBucket,
    restartExecutionOnUpdate: false,
    crossAccountKeys: false,
    stages: [
      {
        stageName: 'Source',
        actions: [
          new cpActions.CodeStarConnectionsSourceAction({
            actionName: 'GitHubSource',
            owner: props.gitHub.owner,
            repo: props.gitHub.repo,
            connectionArn: props.gitHub.connectionArn,
            output: sourceOutput,
            branch: props.gitHub.branch,
          })
        ]
      },
      {
        stageName: 'Build',
        actions: [
          new cpActions.CodeBuildAction({
            actionName: 'CodeBuild',
            project: codebuild.Project.fromProjectArn(props.scope, 'CodeBuildProject', props.codebuildProject.projectArn),
            input: sourceOutput,
            outputs: [buildOutput],
            environmentVariables: {
              ...props.additionalBuildEnv,
              IMAGE_TAG: {
                type:  codebuild.BuildEnvironmentVariableType.PLAINTEXT,
                value: props.gitHub.branch
              }
            },
          })
        ]
      },
      {
        stageName: 'Deploy',
        actions: deployActions
      }
    ]
  });
}

What did you expect to happen?

Exactly as I’m experiencing in 1.99.0, the pipeline is created.

What actually happened?

From 1.100.0 onwards, I’m getting the following error:

C:\path\to\my\project\node_modules\@aws-cdk\aws-codepipeline\lib\pipeline.ts:679
      // For every output artifact, get the producer
              ^
Error: The 'account' property must be a concrete value (action: 'CodeBuild')
    at Pipeline.getOtherStackIfActionIsCrossAccount (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\pipeline.ts:679:15)
    at Pipeline.getRoleFromActionPropsOrGenerateIfCrossAccount (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\pipeline.ts:637:36)
    at Pipeline.getRoleForAction (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\pipeline.ts:574:27)
    at Pipeline._attachActionToPipeline (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\pipeline.ts:405:29)
    at Stage.attachActionToPipeline (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\private\stage.ts:141:27)
    at Stage.addAction (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\private\stage.ts:91:29)
    at new Stage (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\private\stage.ts:38:12)
    at Pipeline.addStage (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\pipeline.ts:335:19)
    at new Pipeline (C:\Repositories\hiwaldo\infrastructure\node_modules\@aws-cdk\aws-codepipeline\lib\pipeline.ts:319:12)
    at Object.exports.buildDeploymentPipeline (C:\Repositories\hiwaldo\infrastructure\lib\services\services\buildDeploymentPipeline.ts:45:10)
Subprocess exited with error 1

Environment

  • CDK CLI Version : aws-cli/2.1.10
  • Framework Version : 1.100.0
  • Node.js Version: 14.15.3
  • OS : Windows 10 Pro
  • Language (Version): TypeScript (3.9.9)

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:23 (22 by maintainers)

github_iconTop GitHub Comments

3reactions
skinny85commented, May 20, 2021

You got it right again 🙂. The PR in #14224 fixed a bug (#14165), but it also accidentally surfaced this problem in your code.

But I would argue the code is actually correct now, and allowing the fromProjectArn to work was a mistake from the beginning.

0reactions
github-actions[bot]commented, May 21, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CodePipeline pipeline structure reference - AWS Documentation
For more information, see the CodePipeline API Reference. The default runOrder value for an action is 1. The value must be a positive...
Read more >
How can I reference a codebuild project from a different region ...
When I run cdk deploy , I got this error: The 'account' property must be a concrete value (action: 'project1').
Read more >
@aws-cdk/aws-codepipeline-actions - npm
When you want to have multiple inputs and/or outputs for a Project used in a Pipeline, instead of using the secondarySources and secondaryArtifacts...
Read more >
aws-cdk.aws-codepipeline-actions 0.32.0 - PyPI
Concrete Actions for AWS Code Pipeline. ... you need to use the extraInputs and extraOutputs properties of the CodeBuild CodePipeline Actions. Example:
Read more >
CodePipeline — Boto3 Docs 1.26.36 documentation
Each stage contains one or more actions that must complete before the next stage begins. ... Whether the configuration property is a required...
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