aws / aws-lambda-go

Libraries, samples and tools to help Go developers develop AWS Lambda functions.
Apache License 2.0
3.58k stars 548 forks source link

[Question] Is the cfn package compatible with `cfn test` ? #447

Open msummers-nr opened 2 years ago

msummers-nr commented 2 years ago

I've written a custom resource using the cfn package. We want to publicly publish the custom resource but cannot get the cfn test contract test suite to run (I do have a rpdk json file). The best I can tell our code is not called at all.

Every test fails with

../../.virtenv/aws-cfn-cli/lib/python3.8/site-packages/rpdk/core/contract/suite/resource/handler_create.py:31: in created_resource
    _status, response, _error = resource_client.call_and_assert(
../../.virtenv/aws-cfn-cli/lib/python3.8/site-packages/rpdk/core/contract/resource_client.py:668: in call_and_assert
    status, response = self.call(action, current_model, previous_model, **kwargs)
../../.virtenv/aws-cfn-cli/lib/python3.8/site-packages/rpdk/core/contract/resource_client.py:689: in call
    status = OperationStatus[response["status"]]
E   KeyError: 'status'

Lambda's output is always

START RequestId: 45e19f24-1001-4be9-ad69-2fa39b3592bd Version: $LATEST
2022/06/28 19:17:18 sending status failed: unknown event request type: 
Put "": unsupported protocol scheme "": Error
null
END RequestId: 45e19f24-1001-4be9-ad69-2fa39b3592bd

None of my logging shows-up in the lambda's output.

Do I need to fallback to cloudformation-cli-go-plugin?

bmoffatt commented 1 year ago

You should probably use the cloudformation-cli-go-plugin - the lambda cfn package pre-dates the feature for publishable CloudFormation resources, so I'm sure there's drift. Not sure right now what the exact differences are. If it's a small difference, then it makes sense to bring the aws-lambda-go/cfn up to parity. But it may be that it's a totally different feature that requires the use of cloudformation-cli-go-plugin.