go-lambda | purpose tool for creating and managing AWS Lambda instances | AWS library
kandi X-RAY | go-lambda Summary
kandi X-RAY | go-lambda Summary
A multi-purpose tool for creating and managing AWS Lambda instances backed by arbitrary Go code
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of go-lambda
go-lambda Key Features
go-lambda Examples and Code Snippets
Community Discussions
Trending Discussions on go-lambda
QUESTION
I recently found an article that has a very specific suggestion for handling errors in Go and Lambda: https://hackernoon.com/error-handling-with-api-gateway-and-go-lambda-functions-fe0e10808732
I'm having trouble implementing it though. I've taken their lambdaError struct and included it in my source. On an error I'm doing the following:
...ANSWER
Answered 2019-Mar-03 at 22:56I ended up determining that the type of "integration" you use matters. There's a couple including lambda
, aws-proxy
and lambda-proxy
. By default it's lambda-proxy
which means that all requests are handed to the function directly without any integration mapping or templates. You need lambda
to do that.
The correct answer and what seems to be standard acceptable practice is to always send errors as nil
and set the status code and response as the response message. If you send and error back Lambda will always return an internal error with 502.
This also means that logging and error tracking are completely up to you. In some cases this is the best approach, if you go the lambda
integration route you'll have to define headers, accepted body and use the "integration mapping" process properly.
You have to make a decision which way you want to go with Lambda.
For full clarity, you're ALWAYS sending an events.APIGatewayProxyResponse back and nil as a second parameter from your handler. So a successful response would be:
QUESTION
I am trying to take a cloudwatch_event and get it into a go struct. I have a CloudwatchEvent struct and inside of that is a blob of json that I need to get into another struct. The first level of the struct seems to work fine, but there is a parsing error when it tries to access the nested json.
This is my sample event. I am trying to get down to detail > EC2InstanceId I think I will also need the status code.
...ANSWER
Answered 2018-Jul-20 at 20:10You were double nesting Detail property. Also "Cause" property in the JSON is a string and not a time.Time, you might want to change it.
That should do the trick.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install go-lambda
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page