aws / aws/aws-cdk

(aws-cloudfront): EdgeFunction NodejsFunction and PythonFunction support

Open
#12,671 9 comments 46 reactions 1 assignee Claimed by @abidhasan-aws View on GitHub
@aws-cdk/aws-cloudfront effort/medium feature-request feature/service-integration p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

@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`](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-nodejs-readme.html) and [`aws-lambda-python`](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-python-readme.html).

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

* [ ] :wave: I may be able to implement this feature request
* [ ] :warning: This feature might incur a breaking change

---

This is a :rocket: Feature Request

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.