lifadev / archive_aws-lambda-go-shim

Author your AWS Lambda functions in Go, effectively.

Home Page:https://github.com/eawsy/aws-lambda-go-shim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use handler with invalid signature

mrserverless opened this issue · comments

Hi eawsy team, first of all, great library and thanks for open sourcing this.

I was able to get aws-lambda-go library working with the serverless framework, code here https://github.com/yunspace/serverless-golang

However when I upgraded to aws-lambda-go-shim, code here: https://github.com/yunspace/serverless-golang/tree/aws-lambda-go-shim I kept getting the following error:

make sls-all
make sls-invoke
{
    "errorMessage": "Cannot use handler 'Handle' with invalid signature"
}

I tried renamed the handler to foo.Bar on purpose to avoid clashing with python handler.Handler. but that didn't help.

The function itself is actually quite simple: https://github.com/yunspace/serverless-golang/blob/aws-lambda-go-shim/handler.go#L10

I then skipped serverless and tried to deploy using AWS commandline directly:

make aws-all
make aws-invoke
{
    "StatusCode": 200
}

plus I get a out file with the same error message. I looked in Cloudtrail and couldn't find anything meaningful either. Is there anything obvious I'm missing? Please help! I trust that the code base and the Makefiles should make reproducing this quite easy.

If I remember correctly from when I tried porting my project, I think you should keep the handler named handler.Handle just like documented in the README.

yep that's what I had in the beginning handler.Handle and I renamed it when I started getting the errors... I'll switch it back and have another go.

can you send me a link to the project you ported if it's publicly available?

I was running into the golang1.8 pre-beta SSL issues so I didn't finish the port and therefore it isn't public yet, but this was my initial diff: http://paste.ubuntu.com/23810429/

It should apply cleanly on top of https://github.com/cristim/autospotting, was initially based on revision bde5e2f717f356e83a918feb6e069af5b8d9a1d6 from that repo.

Later edit: due to some recent buildsystem changes it won't apply on the current HEAD, you'll need to use that revision explicitly.

cool thanks, will take a look in my morning. I've reverted the function name back to handler.Handle, same error still.

I fixed it(together with a few other small fixes) in mrserverless/serverless-golang#1

You just forgot to update the import path.

@yunspace as @cristim resolved your problem, I will close the issue.

awesome, thanks all