Friday, May 12, 2023

AWS CloudFormation error: Properties validation failed for resource LAMBDAXXXX with message: #/Code: expected type: JSONObject, found: String

During a AWS CF deployment I got the following error:

Properties validation failed for resource LAMBDAXXXX with message: #/Code: expected type: JSONObject, found: String

After struggling for over 4 hours, it turned out that the issue was that the path was not correct in the CF Template!!!

  LAMBDAXXXX:
    Type: "AWS::Lambda::Function"
    Properties:
      FunctionName: LambdaIngestXXXX
      Code: "../lambda/lambda_function_folderpath_xxxx/"
      Handler: "lambda_function.lambda_handler"
      Layers:
        - !ImportValue LAYERPYREQUESTS
        - !ImportValue LAYERAWSWRANGLER

The error: "#/Code: expected type: JSONObject, found: String" it turns out translates to "your path ../lambda/lambda_function_folderpath_xxxx/" is wrong!!!

How I hate CloudFormation!!!

Hope this saves someone else time!

No comments: