Skip to content
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

[aws-apigateway] Lambda integration broken for imported functions #8869

Closed
iliapolo opened this issue Jul 2, 2020 · 0 comments · Fixed by #8870
Closed

[aws-apigateway] Lambda integration broken for imported functions #8869

iliapolo opened this issue Jul 2, 2020 · 0 comments · Fixed by #8870
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@iliapolo
Copy link
Contributor

iliapolo commented Jul 2, 2020

Passing in imported function to the LambdaRestApi construct results in the following error:

--
953 | jsii.errors.JavaScriptError:
954 | TypeError: Cannot read property 'functionName' of undefined
955 | at LambdaIntegration.bind (/tmp/jsii-kernel-bC2bV5/node_modules/@aws-cdk/aws-apigateway/lib/integrations/lambda.js:47:52)
956 | at new Method (/tmp/jsii-kernel-bC2bV5/node_modules/@aws-cdk/aws-apigateway/lib/method.js:34:40)
957 | at RootResource.addMethod (/tmp/jsii-kernel-bC2bV5/node_modules/@aws-cdk/aws-apigateway/lib/resource.js:18:16)
958 | at ProxyResource.addMethod (/tmp/jsii-kernel-bC2bV5/node_modules/@aws-cdk/aws-apigateway/lib/resource.js:235:37)
959 | at new ProxyResource (/tmp/jsii-kernel-bC2bV5/node_modules/@aws-cdk/aws-apigateway/lib/resource.js:226:35)
960 | at RootResource.addProxy (/tmp/jsii-kernel-bC2bV5/node_modules/@aws-cdk/aws-apigateway/lib/resource.js:21:16)
961 | at new Lambda

Reproduction Steps

Excerpt taken from aws-cdk-examples

referenced_function = lambda_.Function.from_function_arn(self, id="LocalNameForFunction", function_arn=lambda_arn)
my_api = apigw.LambdaRestApi(self, "myRestAPI", handler=referenced_function)

Environment

  • CLI Version : 1.49.0
  • Framework Version: 1.49.0
  • Node.js Version: ALL
  • OS : ALL
  • Language (Version): ALL

Other


This is 🐛 Bug Report

@iliapolo iliapolo added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 2, 2020
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Jul 2, 2020
@mergify mergify bot closed this as completed in #8870 Jul 2, 2020
mergify bot pushed a commit that referenced this issue Jul 2, 2020
Use `instanceof` to identify real functions vs imported ones and appropriately use whats needed to extract the function name.

Fixes #8869

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
iliapolo added a commit that referenced this issue Jul 2, 2020
Use `instanceof` to identify real functions vs imported ones and appropriately use whats needed to extract the function name.

Fixes #8869

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants