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.

[aws-codepipeline] Cyclic reference error when importing an S3 bucket in a code pipeline defined in a different stack

See original GitHub issue

❓ General Issue

Hi- I am using CDK to create a code pipeline with an S3 bucket as its source. The S3 bucket and code pipeline are defined in different stacks and per the AWS documentation we can access resources in a different stack as long as they are in the same account and AWS region: https://docs.aws.amazon.com/cdk/latest/guide/resources.html#resource_stack

The Question

This doesn’t seem to be working and I am getting a “Cyclic reference” error. Does this mean the AWS documentation is wrong? Or is there something in particular that’s missing to make this work? Sample code below

        const pipelineSourceActionOutput = new Artifact();
        const pipelineSourceAction = new S3SourceAction({
            actionName: "S3SourceAction",
            bucket: s3Bucket, // Versioned Bucket (and CloudTrail) defined in a different stack
            bucketKey: `${id}/upload.zip`,
            output: pipelineSourceActionOutput,
            trigger: S3Trigger.EVENTS,
            runOrder: 1,
        });
        new Pipeline(this, pipelineId, {
            pipelineName: pipelineId,
            stages: [
                {
                    stageName: "Source",
                    actions: [pipelineSourceAction],
                }
            ],
        });

I think this line of code is causing the dependency of my stack containing S3 bucket on the stack that defined code pipeline infra: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts#L120-L124

Environment

  • CDK CLI Version: 1.45.0
  • Module Version:
  • Node.js Version: 12.x.31654.0
  • OS: OSX Mojave
  • Language (Version): TypeScript

Other information

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:22 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
skinny85commented, Feb 9, 2022

@jzybert in the pipeline, you shouldn’t provide source and artifacts for a CodeBuild Project, because those are controlled through the pipeline itself.

Use the PipelineProject class instead of Project, and that will become much more clear 🙂.

0reactions
github-actions[bot]commented, Aug 9, 2022

⚠️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

Troubleshooting CodePipeline - AWS Documentation
Deployment error: A pipeline configured with an AWS Elastic Beanstalk deploy action hangs instead of failing if the "DescribeEvents" permission is missing.
Read more >
@aws-cdk/aws-codepipeline - npm
IProject . etc. These resources can be either newly defined ( new s3.Bucket(...) ) or imported ( s3 ...
Read more >
CDK - S3 notification causing cyclic reference error
The error message indicates, that you use a Lambda. Where is that Lamdba definition? What are you trying to do with SNS?
Read more >
@aws-cdk/aws-codepipeline | Yarn - Package Manager
To construct an empty Pipeline: // Construct an empty Pipeline const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline');.
Read more >
Creating an AWS CodePipeline Stack and troubleshooting ...
AWS CDK is a relatively new framework that aims for faster development of AWS Cloud stacks when compared to AWS CloudFormation and AWS...
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