-
Notifications
You must be signed in to change notification settings - Fork 251
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
OpenApiGatewayToLambda - Use Existing Lambda Version #1250
Comments
Thanks - we'll take a look. |
What we're exploring is adding an optional parameter to ApiIntegration that will give you more control over the Lambda function:
|
Is your Lambda function defined in the same CDK stack as the openapigateway-lambda construct? We're running into an issue where the number for a newly created version is a token and can't be included in the spec (setting up the gateway from the spec is outside of the CDK and can't process tokens). We're starting to look at aliases as an alternative. |
As we work on the PR to address this issue, it strikes us that and Alias and a Function are essentially interchangeable - both implement the IFunction interface. Our first implementation of the PR was to accept an Alias in addition to the function when defining the integration:
But as we learned more, we realized the code only used the Alias - the existingFunction was redundant and opened up a possible error of being a different function. The ideal solution would be to accept an Alias xor an existing Function. Here's our hesitation. The Construct exposes a list of Lambda functions used for the integration:
Accepting just an Alias means we would need to make the lambdaFunction an optional attribute:
This will cause a Typescript transpilation error for any client who accesses the Lambda function in this array. Since any current client is providing a Function (or Props), the value will still be populated - the error will be easily addressed by using an exclamation point to tell Typescript that you are certain the value is populated:
We're looking for customer thoughts on requiring clients accessing the Lambda function to make this edit? Is the value of avoiding the redundancy worth the disruption? |
Is it possible to specify a Version/Alias when using the OpenApiGatewayToLambda ApiIntegration with an existing Lambda object?
Use Case
I'm hoping to use OpenApiGatewayToLambda with a versioned Lambda, so I can use SnapStart.
Currently, I believe the construct gets the Function ARN, which is for $LATEST.
Proposed Solution
Possibly have a "existing_lambda_version_obj" or "existing_lambda_alias_obj" type as input for the ApiIntegration - then extract the ARN for that version/alias in the OpenAPI Helper class, when it works out the uriResolvedValue
Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: