Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(cloudfront): cross region EdgeFunction does not work within a Stage #12092

Closed
corymhall opened this issue Dec 15, 2020 · 2 comments · Fixed by #12103
Closed

(cloudfront): cross region EdgeFunction does not work within a Stage #12092

corymhall opened this issue Dec 15, 2020 · 2 comments · Fixed by #12103
Assignees
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. in-progress This issue is being actively worked on.

Comments

@corymhall
Copy link
Contributor

If I create an EdgeFunction in a region other than us-east-1, it throws an error if it is being created in a Stage

You cannot add a dependency from 'Blog-Frontend/TestStack' (in Stage 'Blog-Frontend') to 'edge-lambda-stack-us-east-2' (in the App): dependency cannot cross stage boundaries

Reproduction Steps

export class Frontend extends cdk.Stage {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StageProps) {
    super(scope, id, props);
    const testStack = new cdk.Stack(this, 'TestStack', { env: region: 'us-east-2' });
    new cloudfront.experimental.EdgeFunction(testStack, 'EdgeFunction', {
      code: lambda.Code.fromAsset(path.join(__dirname, '../code')),
      runtime: lambda.Runtime.NODEJS_12_X,
      handler: 'index.handler',
    });
  }
}

What did you expect to happen?

I expect the edge-lambda-stack-us-east-2 support stack to be created within the parent stage.

What actually happened?

It looks like instead of creating the edge-lambda-stack-us-east-2 support stack within the parent Stage, it is creating it within the root App.

It looks like it may be caused by this line:

Environment

  • CDK CLI Version : 1.78.0
  • Framework Version: 1.78.0
  • Node.js Version: v12.16.1
  • OS : Ubuntu 18.04
  • Language (Version): TypeScript

Other


This is 🐛 Bug Report

@corymhall corymhall added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 15, 2020
@github-actions github-actions bot added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Dec 15, 2020
njlynch added a commit that referenced this issue Dec 16, 2020
The creation of the cross-region stack was always defaulting to the root,
resulting in potential cross-stage dependencies.

fixes #12092
@njlynch
Copy link
Contributor

njlynch commented Dec 16, 2020

Thanks for the bug report (and being an early adopter of EdgeFunction)! Fix is #12103.

@njlynch njlynch added in-progress This issue is being actively worked on. and removed needs-triage This issue or PR still needs to be triaged. labels Dec 16, 2020
njlynch added a commit that referenced this issue Jan 5, 2021
The creation of the cross-region stack was always defaulting to the root,
resulting in potential cross-stage dependencies.

fixes #12092
@mergify mergify bot closed this as completed in #12103 Jan 5, 2021
mergify bot pushed a commit that referenced this issue Jan 5, 2021
…ge (#12103)

The creation of the cross-region stack was always defaulting to the root,
resulting in potential cross-stage dependencies.

fixes #12092

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Jan 5, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. in-progress This issue is being actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants