How to handle manual invoked AWS lambda

I am manually invoking my lambda function since the 30s HTTP gateway timeout is too short for my purpose. The function was working when using HTTP, but when I manually invoke the function, the request.Body is empty.

Here is the handler on my lambda code:

    func handler(request events.APIGatewayProxyRequest) 
        (events.APIGatewayProxyResponse, error) {
        // Left out implementation details.
        // request.Body == "" here

Here is how I invoke it:

    func InvokeHooknode(req *HooknodeReq) error {
    	// Serialize params
    	payload, err := json.Marshal(*req)
    	if err != nil {
    		return err
    	// Invoke lambda.
    	client := lambda.New(sess)
    	res, err := client.Invoke(&lambda.InvokeInput{
    		FunctionName: aws.String(hooknodeFnName),
    		Payload:      payload,
    	if err != nil {
    		return err
    	return nil

I’ve printed out payload, and it looks correct. I’m just not sure how to access the payload in my lambda handler.

If you are using the AWSCLI you can try this:

If you’re directly invoking the Lambda then the event the handler receives should be the same event you sent when you invoked the Lambda. You won’t be receiving an APIGatewayProxyRequest anymore. Hence not request.Body.

1 Like

Yeah, this solves my issue. Thanks!