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.

CDK Pipelines: Circular dependency on initial CDK Deploy

See original GitHub issue

What is the problem?

I am trying to deploy a pipeline using the aws-cdk/pipelines library and I am receiving a circular dependency error. I have no other resources in this stack other than the pipeline itself.

Reproduction Steps

Outer Stack:

import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { SplitMonitorStackStack } from '../lib/MainPipelineStack';

const app = new cdk.App();
new SplitMonitorStackStack(app, 'SplitMonitorMainStack');
app.synth();

Inner Stack:


import { Stack, StackProps,SecretValue} from 'aws-cdk-lib';
import { Construct } from 'constructs'; // construct is in a separate package
import * as pipelines from 'aws-cdk-lib/pipelines';

export class SplitMonitorStackStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);


    const splitMonitoringStackPipeline = new pipelines.CodePipeline(this, "pipeline", {
      pipelineName: "Split-Monitor-Main",
      synth: new pipelines.ShellStep('Synth', {
          input: pipelines.CodePipelineSource.gitHub('PlaceholderRepoName', "main", {
            authentication: SecretValue.secretsManager('Token'),
          }),
          commands: [
            'npm install -g aws-cdk@latest',
            'npm ci',
            'npm run build',
            'npx cdk synth',
          ],
        }),
        crossAccountKeys: true
    });

  }
}

What did you expect to happen?

The pipeline and CDK deploy do be successful.

What actually happened?

SplitMonitorMainStack failed: Error [ValidationError]: Circular dependency between resources: [pipelineUpdatePipelineSelfMutation14A96D2F, pipelinePipelineBuildSynthCdkBuildProject4237770A, pipelinePipelineBuildSynthCdkBuildProjectRoleDefaultPolicyB3981181, pipelineUpdatePipelineSelfMutationRoleDefaultPolicy095404B8, pipelinePipeline4163A4B1, pipelinePipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicy09E3C254, pipelinePipelineSourceIvellaSplitMonitorStackWebhookResource4158C29A, pipelinePipelineBuildSynthCodePipelineActionRoleDefaultPolicy7B8E3FCA] at Request.extractError (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/protocol/query.js:50:29) at Request.callListeners (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:106:20) at Request.emit (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:78:10) at Request.emit (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:686:14) at Request.transition (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:14:12) at /opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request.<anonymous> (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:38:9) at Request.<anonymous> (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:688:12) at Request.callListeners (/opt/homebrew/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:116:18) { code: 'ValidationError', time: 2022-01-26T18:54:30.449Z, requestId: '913f9618-4a60-483a-b8b4-aec4be38998a', statusCode: 400, retryable: false, retryDelay: 755.4424894449671 } Circular dependency between resources: [pipelineUpdatePipelineSelfMutation14A96D2F, pipelinePipelineBuildSynthCdkBuildProject4237770A, pipelinePipelineBuildSynthCdkBuildProjectRoleDefaultPolicyB3981181, pipelineUpdatePipelineSelfMutationRoleDefaultPolicy095404B8, pipelinePipeline4163A4B1, pipelinePipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicy09E3C254, pipelinePipelineSourceIvellaSplitMonitorStackWebhookResource4158C29A, pipelinePipelineBuildSynthCodePipelineActionRoleDefaultPolicy7B8E3FC

CDK CLI Version

2.9.0

Framework Version

No response

Node.js Version

v16.13.0

OS

macOS Monterey

Language

Typescript

Language Version

No response

Other information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:11
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
wilhen01commented, Jan 27, 2022

Also seeing this issue with existing pipelines attempting to self mutate on upgrade to 2.9.0. Will revert to 2.8.0 in our pipelines…

EDIT: Pipelines reverted to 2.8.0, can confirm the issue is resolved.

1reaction
terryobotcommented, Feb 7, 2022

im still having this issue on python a version downgrade has not resolved it. ❌ TAPP-Infrastructure-Pipeline failed: Error [ValidationError]: Circular dependency between resources: [TappPipeline03E6EFD5, TappPipelineBuildSynthCodePipelineActionRoleDefaultPolicy0692F3F9, TappPipelineBuildSynthCdkBuildProject1ABF2DA8, TappPipelineSourceterryobotdevopsWebhookResourceDFC0CED5, TappPipelineBuildSynthCdkBuildProjectRoleDefaultPolicyB7B22B1C] at Request.extractError (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/protocol/query.js:50:29) at Request.callListeners (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:106:20) at Request.emit (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:78:10) at Request.emit (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:686:14) at Request.transition (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:14:12) at /usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request.<anonymous> (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:38:9) at Request.<anonymous> (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:688:12) at Request.callListeners (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:116:18) { code: ‘ValidationError’, time: 2022-02-07T10:14:20.629Z, requestId: ‘721d0849-f24a-4c6f-bf8f-d715686bb81d’, statusCode: 400, retryable: false, retryDelay: 64.29169948893887 } Circular dependency between resources: [TappPipeline03E6EFD5, TappPipelineBuildSynthCodePipelineActionRoleDefaultPolicy0692F3F9, TappPipelineBuildSynthCdkBuildProject1ABF2DA8, TappPipelineSourceterryobotdevopsWebhookResourceDFC0CED5, TappPipelineBuildSynthCdkBuildProjectRoleDefaultPolicyB7B22B1C]

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolving cyclical dependencies between AWS CDK ...
We tried to model this in CDK by creating a direct dependency in Stack_B on Stack_A, using references to IAMRole_A and S3Bucket_A within ......
Read more >
Handling circular dependency errors in AWS CloudFormation
When you get a circular dependency error, the first step is to examine the resources that are outlined and ensure that AWS CloudFormation ......
Read more >
Weird circular dependency issue when updating a CDK ec2 ...
I am using CDK pipelines here to deploy a very simple stack. The stack consists of 2 sub-stacks: an Aurora cluster and an...
Read more >
awslabs/aws-cdk - Gitter
It looks like it creates a circular dependency: Error: 'env-dev/buckets' depends on 'env-dev/app-frontend' (env-dev/buckets -> env-dev/app-frontend/web- ...
Read more >
CDK Cross-Account Pipelines - AWS in Plain English
This is required for CDK Pipelines and enables cross-account deployments. There are two other requirements ... A circular dependency, which is always fun....
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