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

Go plugin seems to need different event.json file than similar example using Python #191

Open
TobyHFerguson opened this issue Mar 9, 2021 · 1 comment

Comments

@TobyHFerguson
Copy link

Overview

A python example translated to Go fails, and it appears that this is because of the way that the event file is treated in the Python case vs the Go case.

Details

I took a working example from Writing an AWS CloudFormation Resource Provider in Python: Step by Step and translated the handlers into Go. I left the various events alone, using the ones that worked with python.

I setup my environment as documented in Setting up your environment for developing extensions

However I then got a failure which seems to my inexperienced eye (and some debugging) to be in the handoff of the event from the sam local invoke to the cloudformation-cli-go-plugin:

(cfn-go) bash-5.0$ sam local invoke TestEntrypoint --event events/create.json
Invoking handler (go1.x)
Failed to download a new amazon/aws-sam-cli-emulation-image-go1.x:rapid-1.0.0 image. Invoking with the already downloaded image.
Mounting /Users/tobyferguson/Development/CFN-step-by-step-go/bin as /var/task:ro,delegated inside runtime container
2021/02/25 21:45:58 Handler starting
START RequestId: 39e6a5ec-2557-1956-f123-a2eb92eef0f3 Version: $LATEST
Validation: Failed Validation
caused by: Region: zero value, BearerToken: zero value: baseError
null
2021/02/25 21:45:58 Handler received the CREATE action
END RequestId: 39e6a5ec-2557-1956-f123-a2eb92eef0f3
REPORT RequestId: 39e6a5ec-2557-1956-f123-a2eb92eef0f3	Init Duration: 192.37 ms	Duration: 5.69 ms	Billed Duration: 100 ms	Memory Size: 256 MB	Max Memory Used: 24 MB	

{"errorType":"baseError","errorMessage":"Validation: Failed Validation\ncaused by: Region: zero value, BearerToken: zero value"}

I'm not (yet) sure if this is a sam issue, or a cloudformation-cli-go-plugin issue but, given that this works with python and not with Go, I am going to start with the Go plugin!

The code and test case are on the master branch of my public repo CFN-step-by-step-go.

Follow the instructions there to generate an event file (it contains private keys, so is not copied here), and use it in to reproduce the issue.

@skellish-aws
Copy link

Hi Tony,
Did you ever get this resolved? I'm having the same error trying to debug a custom resource

--Scott@AWS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants