(aws-cloudfront): EdgeFunction NodejsFunction and PythonFunction support
See original GitHub issue@njlynch 's new EdgeFunction
(see https://github.com/aws/aws-cdk/pull/10500) is very handy for when a stack is deployed outside of us-east-1.
As of now, it extends lambda.FunctionProps
, which prevents using the convenience lambda operators such as aws-lamdba-nodejs
and aws-lambda-python
.
It would be great if you could somehow specify that you want to bundle using the convenience operators while still taking advantage of the cross-region behaviors provided by EdgeFunction
.
Use Case
I almost always use Typescript alongside aws-lambda-nodejs
’s NodejsFunction
operator. This provides me type-safety when developing. However, I also want to deploy my main stack in us-west-2
, so EdgeFunction
is really handy for me.
Proposed Solution
A (potentially naive) solution would be to provide EdgeFunction
, EdgeNodejsFunction
, EdgePythonFunction
, etc.
Another idea would be to somehow specify the type of Lambda you’re using in property, e.g.,
new cloudfront.experimental.EdgeFunction(this, 'EdgeFunction', {
functionType: cloudfront.experiment.EdgeFunctionType.NODE_JS, // maybe default to regular lamdba.Function here?
functionProps: { }, // Typescript requires NodejsFunctionProps here
});
Other
- 👋 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 3 years ago
- Reactions:20
- Comments:6 (4 by maintainers)
Top GitHub Comments
Thanks for the feature request.
I agree this would be really useful, and was something discussed in the initial implementation. See also #12498 for a related request. There’s a few options here to proceed, with varying degrees of copy/paste required. 😃. Happy to discuss design options with you, @blimmer (or anyone else who wants to pick this up!).
See #15661 for a duplicate issue and good discussion of at least one approach, including this comment ( https://github.com/aws/aws-cdk/issues/15661#issuecomment-884033318 ) which suggests an approach for exposing and extracting the bundling into a re-usable component.
I actually prototyped something along those lines a long time ago, but ran into some slight awkwardness in the API I didn’t love. Curious for the opinions of @eladb , @jogold , and @nija-at about that idea.