mrserverless / serverless-golang

AWS Lambda Go functions using Serverless Framework and Python shim
Other
302 stars 21 forks source link

How to implement wrapper around handler ? #43

Open Hareramrai opened 5 years ago

Hareramrai commented 5 years ago

Hi,

I want to implement a wrapper around handler to add some generic code.

Do you know how to implement this using serverless-golang.

Also I found an npm package for nodejs wrapper. Is it possible to use below npm package in the same?

https://github.com/maasglobal/serverless-wrapper-plugin

cristim commented 5 years ago

What's your use case?

I'm not using serverless to deploy my Lambda function but AutoSpotting is written in Go and can run in Lambda, as well as stand-alone from the CLI. I just extracted the content of the handler into a function, which I can call from the handler or another way of running that code.

Have a look at https://github.com/AutoSpotting/AutoSpotting/blob/master/autospotting.go#L35

Hareramrai commented 5 years ago

Hi @cristim, Thanks for the reply. I am looking to add a rollbar error handler.

There is nodejs package for the same but I want to implement similar things for golang.

https://www.npmjs.com/package/lambda-rollbar