You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have created a lambda using aws_lambda.Function class in the python CDK. When we try and synth that object, it works, but running it results in an Unhashable type error. I believe this has something to do with the fact that the function name in the generated template does an ImportValue operation.
Here is the aws_lambda.Function cdk generated template:
Metadata:our_company-cdk-lib: our_company_cdk.our_company_lambda.FunctionResources:functionlambdaServiceRoleF834821F:Type: AWS::IAM::RoleProperties:AssumeRolePolicyDocument:Statement:- Action: sts:AssumeRoleEffect: AllowPrincipal:Service: lambda.amazonaws.comVersion: "2012-10-17"ManagedPolicyArns:- Fn::Join:- ""- - "arn:"- Ref: AWS::Partition- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRoleMetadata:aws:cdk:path: user-test-stack/functionlambda/ServiceRole/ResourcefunctionlambdaEDFDB073:Type: AWS::Lambda::FunctionProperties:Code:S3Bucket:Fn::Sub: cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}S3Key: bb6e05f01acd0af30f089eed0751198cbff29e3408aab40971d26a9d3cb86e21.zipEnvironment:Variables:environment:Fn::ImportValue: our_company-cdk-vars-envFunctionName:Fn::Join:- ""- - Fn::ImportValue: our_company-cdk-vars-env- -functionlambdaHandler: app.lambda_handlerMemorySize: 128Role:Fn::GetAtt:- functionlambdaServiceRoleF834821F- ArnRuntime: python3.10Timeout: 30DependsOn:- functionlambdaServiceRoleF834821FMetadata:aws:cdk:path: user-test-stack/functionlambda/Resourceaws:asset:path: asset.bb6e05f01acd0af30f089eed0751198cbff29e3408aab40971d26a9d3cb86e21aws:asset:is-bundled: falseaws:asset:property: CodeParameters:BootstrapVersion:Type: AWS::SSM::Parameter::Value<String>Default: /cdk-bootstrap/hnb659fds/versionDescription: Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]Rules:CheckBootstrapVersion:Assertions:- Assert:Fn::Not:- Fn::Contains:- - "1"- "2"- "3"- "4"- "5"- Ref: BootstrapVersionAssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.
Steps to reproduce:
Using CDK:
create a simple hello world lambda in python using sam init
delete the generated template file and instead create a cdk stack.py with an aws_lambda.Function construct pointed to the new lambda.
for the function_name parameter, import a value into the name, example:
colemanjackson
changed the title
Sam local invoke results in Error: unhashable type: 'collections.OrderedDict' for CDK created lambda
Sam local invoke results in Error: unhashable type: 'collections.OrderedDict' for CDK created lambda with Imported Value in function name
Sep 11, 2023
Description:
We have created a lambda using aws_lambda.Function class in the python CDK. When we try and synth that object, it works, but running it results in an Unhashable type error. I believe this has something to do with the fact that the function name in the generated template does an ImportValue operation.
Here is the aws_lambda.Function cdk generated template:
Steps to reproduce:
Using CDK:
sam init
sam local invoke
using newly generated template.yamlObserved result:
Expected result:
We expected a hello world response, this works when using the aws_lambda.Function class when we provide a name that is not importing a value.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Can anyone assist me in figuring out why this is failing?
The text was updated successfully, but these errors were encountered: