-
Notifications
You must be signed in to change notification settings - Fork 246
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-lambda: aws_lambda.Function.from_function_arn returns FunctionBaseProxy instead of IFunction object #4657
Comments
I'm having this same issue and it seems to be caused by an upgrade to I had 4.3.0 installed before pinning to 2.13.3:
|
I'm having a similar issue with the recent typeguard changes. 2.13.3 works for me but if I upgrade to v3 I get a bunch of warnings and v4 actually prevents cdk synthesis because This happened between CDK version 2.157 and 2.158 where the typeguard dependency was incremented drastically from 2.13.3 to 4.3.0. |
Trying to avoid saying the same thing, but this issue is reproducable on python 3.11 as well. When creating a lambda function, the layers supposedly are not of type
Setting |
@arutz12 , thanks for reaching out. Sharing my analysis -
public static fromFunctionArn(scope: Construct, id: string, functionArn: string): IFunction {
return Function.fromFunctionAttributes(scope, id, { functionArn });
}
However I am trying to repro the scenario. |
As documented in cdk docs, the fromFunctionArn should return IFunction object -https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html#static-fromwbrfunctionwbrarnscope-id-functionarn |
This seems like a JSII issue, so moving to JSII Repo for further action. |
Hey @arutz12 Thanks for reporting this issue. While there are some current ongoings with jsii in this area (like @khushail confirmed), I don't think the issue you are running into is that.
However you are trying to give it the result of |
https://github.com/aws/constructs/releases/tag/v10.3.2 It looks like they will address this issue in the constructs repo, but if you need more code that fails with typeguard on 4.3.0 I was using this code to replicate the error:
|
Thanks @kmonihen More reproduction code is always helpful. Your example should work indeed because It does seem that the old version of |
So even if the issue mentioned above (proper return values for from_function_arn) is fixed this complex construct can only be implemented in the same stack, so I have to look for another solution in my case. |
Yes, I that's about it. You can try reaching out to aws-solutions-constructs if they would be willing to support your use case. Closing this. The open jsii issue is tracked here #4658 |
This issue is now closed. Comments on closed issues are hard for our team to see. |
1 similar comment
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
CDK: 2.161.1
Python: 3.9.18 (and 3.11.7)
aws-solutions-constructs.aws-eventbridge-lambda: 2.72.0
aws_lambda.Function.from_function_arn
returns FunctionBaseProxy instead of IFunction as documented.Therefore the object fails when typechecked in the aws-solutions-constructs.aws-eventbridge-lambda module:
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Function returns object of type IFunction as documented.
Current Behavior
Function returned FunctionBaseProxy object.
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.161.1
Framework Version
No response
Node.js Version
v18.17.1
OS
KDE neon 6.2 (Ubuntu 22.04)
Language
Python
Language Version
3.9.18 (also 3.11.7)
Other information
Running synth on the code:
The text was updated successfully, but these errors were encountered: