-
Notifications
You must be signed in to change notification settings - Fork 249
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
fix(core) id conflict with multiple buildLambdaFunction() calls #910
fix(core) id conflict with multiple buildLambdaFunction() calls #910
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…n() calls in the same stack
df9d6a4
to
c760e2b
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thanks for the PR! We're having trouble producing the issue this is addressing, can you post code that triggers the bad behavior? |
Sure I'll prepare a gist with code to reproduce it tomorrow, thanks 👍 |
Hi! I added a sample repository here with the instructions to reproduce the issue: https://github.com/alsoknownasdrew/build-lambda-function-reproduction Let me know if other info is needed ;) |
Looks good, thanks. This will get published to npm/pypi/etc. upon the next release. |
This was released in v2.33.0 on 5/3/2023. I should point out that calling the non-documented functions in core assumes a risk, as they can change outside of the scope of a major release. |
…n() calls in the same stack (#910)
* README for new openapi-based apigatway-to-lambda construct. * fix(core) prevent lambda id conflict with multiple buildLambdaFunction() calls in the same stack (#910) * chore(release): 2.33.0 * chore(release prep): Update CHANGELOG.md and align-version.js * Freeze @types/node version in cdk-integ * Freeze @types/node version in cdk-integ * Update step functions integ tests * chore(core): Add warnings about using core functions from outside of Solutions Constructs (#917) * Add file header warning * Add function header comments * Use latest CDK to address .NET version issue * Fix 2 typos * One last typo * fix(StepFunctions): Address LogGroup behavior problems (#922) * Implementation * Clean up some code cruft * Update package.json * chore(release): 2.34.0 * chore(release-prep): Updated CHANGELOG.md and align-version.js * chore(release-prep): align-version.js * chore(core): migrate to assertions (#929) * First two test updates * chore(core): migrate to assertions * Remove old lib, final few modules * Update the cloudfront-to-s3 construct to correctly set the logging bucket property. (#930) * Update README * Update openapigateway-to-lambda README * Update README/architecture for openapigateway-to-lambda. * Add openapigateway-to-lambda code and initial tests * update openapigateway-to-lambda package.json dependency versions. * Update openapigateway-to-lambda * Update openapigateway README * don't depend on NodeJsFunction docker env * Update openapigateway-to-lambda README to reflect actual construct API. * temp commit * Update snapshot test for openapigateway-to-lambda construct. * fix package.json version field * update snapshot * update openapigateway-to-lambda custom resource to suppress standard cfn nag warnings. * [wip] resources project * fix dependency self reference on new resources module * fix dependency self reference on new resources module * Add integ test to the template writer resource. * Add integ tests to template-writer resource. * Update template-writer resource integ tests to clean up test buckets automatically * Add additinal tests to get 100% coverage on aws-openapigateway-lambda * Add additional integration tests to template resource writer and aws-openapigateway-lambda. * remove eslintignore line that was obsolete * cleanup eslint ignore and update openapigateway-to-lambda props. * Update python/java code samples for openapigateway-to-lambda. * Update openapigateway-to-lambda README * Update resources README * Update resources integ test * update resources integ test snapshot * Update integ test snapshots for aws-openapigateway-lambda. * Update aws-openapigateway-lambda construct to trigger api deployments anytime the incoming api template changes or any time the lambda functions change. * Add new integ test for cognito authorizer on aws-openapigateway-lambda construct. * address minor pr feedback. * Remove integration tests that use BucketDeployment as the asset hash of the AwsCliLayer changes outside our control. * Remove integration tests that use BucketDeployment as the asset hash of the AwsCliLayer changes outside our control. * Address pr feedback. Add new template writer integration test for transforming large template with several thousand substitutions Several new comments/documentation to make the obscure less so, hopefully> * Add additional tests to aws-openapigateway-lambda construct. * Update integ tests after latest cdk lib update. * Add optional construct id parameter to the buildLambdaFunction function. * Update aws-openapigateway-lambda property descriptions to better explain optional custom resource values. --------- Co-authored-by: Andriy <andriy.frankevych@gmail.com> Co-authored-by: AWS Solutions Constructs Automation <aws-solutions-constructs-team@amazon.com> Co-authored-by: biffgaut <biffgaut@amazon.com> Co-authored-by: biffgaut <78155736+biffgaut@users.noreply.github.com>
Description of changes:
Currently multiple calls to
buildLambdaFunction()
withlambdaFunctionProps
in the same stack throws the following error:Error is caused by a call to
deployLambdaFunction()
withundefined
as function id. SodeployLambdaFunction
creates a lambda with the same default id for every call.This PR fixes the issue by passing
lambdaFunctionProps.functionName
as lambda id todeployLambdaFunction()
and adds 2 new tests tolambda-helper.test.ts
:By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.