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

aws-cloudfront: Support cloudfront-js-2.0 runtime #28163

Closed
2 tasks
jmortlock opened this issue Nov 28, 2023 · 5 comments · Fixed by #28099
Closed
2 tasks

aws-cloudfront: Support cloudfront-js-2.0 runtime #28163

jmortlock opened this issue Nov 28, 2023 · 5 comments · Fixed by #28099
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@jmortlock
Copy link
Contributor

Describe the feature

Cloudfront functions support either "cloudfront-js-1.0" or "cloudfront-js-2.0" runtimes

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-javascript-runtime-features.html

Use Case

AWS provide example functions here: https://github.com/aws-samples/amazon-cloudfront-functions

Not all of them are cloudfront-js-1.0 v1 compatible; specifically I was using the URL rewrites and redirect example.

Proposed Solution

Add a new enum property to allow the user to choose which runtime is used.

Other Information

Available in cloudformation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-function-functionconfig.html

Currently Hardcoded in CDK: https://github.com/aws/aws-cdk/blob/85cc0c686049ca40a0bc09589830a909e911fbdf/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts#L168C19-L168C36

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.111.0

Environment details (OS name and version, etc.)

Linux

@jmortlock jmortlock added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 28, 2023
@github-actions github-actions bot added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Nov 28, 2023
@go-to-k
Copy link
Contributor

go-to-k commented Nov 28, 2023

The PR has already been submitted👍

#28099

@pahud
Copy link
Contributor

pahud commented Nov 28, 2023

Awesome! Can't wait to see the 2.0 runtime support in CDK.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 28, 2023
@prerakhere
Copy link

Great. Can't wait!

@mridehalgh
Copy link

Before we have L2 support, you should be able to enable this feature like this:

const cfFunction = new aws_cloudfront.Function(this, 'Function', {
      ...
    });

(cfFunction.node.defaultChild as aws_cloudfront.CfnFunction).addPropertyOverride("FunctionConfig.Runtime", "cloudfront-js-2.0")

@mergify mergify bot closed this as completed in #28099 Dec 29, 2023
mergify bot pushed a commit that referenced this issue Dec 29, 2023
fixed #28163
This provides an option to change the runtime for CloudFront Functions. This makes it easier to access the CloudFront KeyValueStore.


https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-function-functionconfig.html

----

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

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

paulhcsun pushed a commit to paulhcsun/aws-cdk that referenced this issue Jan 5, 2024
fixed aws#28163
This provides an option to change the runtime for CloudFront Functions. This makes it easier to access the CloudFront KeyValueStore.


https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-function-functionconfig.html

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants