(aws-lambda-nodejs): NodejsFunction support EdgeFunction for Lambda@Edge
See original GitHub issueIf I wish to use NodejsFunction to create a Lambda@Edge, I need to make sure that my whole stack is currently in us-east
.
If there was a prop or flag on NodejsFunction props, we could easily deploy our NodeJS functions to Lambda@Edge.
Something similar likely needs to happen with other lambda helpers.
It seems someone has already made a EdgeFunction construct: https://github.com/aws/aws-cdk/pull/10500
So it could be a case of just refactoring so that there was a class that inherited from that instead of lambda.Function.
This would probably need to be done with the go/python helpers, too.
Use Case
I would like to use NodejsFunction to create lambdas that can be used with Lambda@Edge with my stack in any region.
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
class EdgeFunction (construct) · AWS CDK
Convenience resource for requesting a Lambda function in the 'us-east-1' region for use with Lambda@Edge. Implements several restrictions enforced by Lambda@ ...
Read more >Deploy Lambda@Edge with AWS CDK and TypeScript
I took a closer look at NodejsFunction and EdgeFunction and transferred the TypeScript functionality from NodejsFunction to EdgeFunction.
Read more >Tutorial: Creating a simple Lambda@Edge function
This tutorial shows you how to get started with Lambda@Edge by helping you create and add a sample Node.js function that runs in...
Read more >Making Lambda@Edge and executing `cdk deploy` occurred ...
I want to deploy lambda@edge source code by aws-cdk . new NodejsFunction(this, 'some-awesome-function', { role: new Role(this ...
Read more >@aws-cdk/aws-lambda-nodejs | Yarn - Package Manager
Node.js Function. The NodejsFunction construct creates a Lambda function with automatic transpiling and bundling of TypeScript or Javascript code. This results ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think a better implementation would be to publicly expose the bundler in
aws-lambda-nodejs
as a top-level component instead of keeping it package private.https://github.com/aws/aws-cdk/blob/464cdc0baa1fc5b0634e428a9c7a15de4ca93d50/packages/%40aws-cdk/aws-lambda-nodejs/lib/bundling.ts#L40
This would allow any kind of lambda function to rely on the esbuild bundler. This would benefit
https://github.com/aws/aws-cdk/blob/464cdc0baa1fc5b0634e428a9c7a15de4ca93d50/packages/%40aws-cdk/aws-cloudfront/lib/experimental/edge-function.ts#L37
and
https://github.com/aws/aws-cdk/blob/464cdc0baa1fc5b0634e428a9c7a15de4ca93d50/packages/%40aws-cdk/aws-cloudfront/lib/function.ts#L133
As an example, the following snippet works for deploying Lambda@Edges but it relies on the
Bundling
component which is internal toaws-lambda-nodejs
Cannot import Bundling with CDK v2 :