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-cdk/pipelines: Pipeline stack which uses cross-environment actions must have an explicitly set region

See original GitHub issue

I’ve run into an error that i just can’t resolve, i’ve reduced the problem down to a minimum, where i can still reproduce it.

The error is

jsii.errors.JSIIError: Pipeline stack which uses cross-environment actions must have an explicitly set region

I am trying to add multiple stacks to a stage. The stacks are in different accounts… I’m creating the stage… and and adding it to my pipeline…

stage_env = core.Environment(
                account='111111222222',
                region='ap-southeast-2' 
            )
this_stage = PipelineStage(self, f'{stage_name}',
                env = stage_env,
                stage_stacks = stage_cfg['Stacks'],
                local_lookup_profile = pipeline_cfg['Pipeline']['LocalLookupProfile']
            ) 
self.pipeline.add_application_stage(
                app_stage = this_stage,
            )

The Pipeline stage is configured like this…

class PipelineStage(cdk.Stage):
    def __init__(self, scope, id: str, *, env=None, outdir=None, stage_stacks: dict, local_lookup_profile: str, **kwargs):
        super().__init__(scope, id, env=env, outdir=outdir, **kwargs)
        print(self.region)
        print(self.account)
        Mystack= Stack(self, 'blahblah',
                        env = cdk.Environment(
                            account='1111113333333',
                            region='ap-southeast-2'
                        )
        )

and the stack ( which is just empty right now for the sake of testing.

class Stack(cdk.Stack):
    def __init__(self, scope: cdk.Stack, id: str, *, env=None,  **kwargs):
        super().__init__(scope, id, env=env,**kwargs)

when i cdk synth this… i get the error above, but I’m confused, because i’ have ( well i think i have ) set the environment for the stack…

I belive i’m

Environment

  • CDK CLI Version: 1.94.1 (build 60d8f91)
  • OS: Amazon Linux 2
  • Language (Version): Python 3.8.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
skinny85commented, Mar 29, 2021

Hey @mrpackethead ,

can you show how do you create the Pipeline Stack?

Thanks, Adam

0reactions
github-actions[bot]commented, Mar 29, 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

Pipeline stack which uses cross-environment actions must ...
it says "the pipeline" should have an explicitly set region, while Pipeline type doesn't have a property for region - it probably should...
Read more >
Add a cross-Region action in CodePipeline
Describes how to use the console, AWS CLI, or AWS CloudFormation to create a cross-Region action for use in a pipeline.
Read more >
AWS CDK Pipelines: Real-World Tips and Tricks — Part 1
How do I deploy cross-environment? All resources which need to be deployed to the same environment — an AWS account and region combination...
Read more >
Convert existing CDK App into CDK Pipeline - Stack Overflow
I then get errors around Error: Pipeline stack which uses cross-environment actions must have an explicitly set region .
Read more >
The CDK pipeline construct | tecRacer Amazon AWS Blog
Besides the bucket you will need some extra roles for a pipeline and for using custom Containers, also the bootstrap stack added an ......
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