# How to handle manual invoked AWS lambda

**URL:** https://forum.serverless.com/t/how-to-handle-manual-invoked-aws-lambda/5515
**Category:** Serverless Framework
**Tags:** aws
**Created:** [August 21, 2018, 2:38pm UTC](https://forum.serverless.com/t/how-to-handle-manual-invoked-aws-lambda/5515 "2018-08-21T14:38:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AaronVasquez](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/aaronvasquez/32/2423_2.png) [@AaronVasquez](https://forum.serverless.com/u/AaronVasquez)
#### Post date: [August 21, 2018, 2:38pm UTC](https://forum.serverless.com/t/how-to-handle-manual-invoked-aws-lambda/5515/1 "2018-08-21T14:38:22Z")

</div>

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:

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

```

Here is how I invoke it:

```auto
    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.

---

<div class="post-metadata">

### Author: ![kamarja](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/kamarja/32/2439_2.png) [@kamarja](https://forum.serverless.com/u/kamarja)
#### Post date: [August 22, 2018, 1:39am UTC](https://forum.serverless.com/t/how-to-handle-manual-invoked-aws-lambda/5515/2 "2018-08-22T01:39:20Z")

</div>

If you are using the AWSCLI you can try this:

[https://docs.aws.amazon.com/lambda/latest/dg/with-userapp-walkthrough-custom-events-invoke.html](https://docs.aws.amazon.com/lambda/latest/dg/with-userapp-walkthrough-custom-events-invoke.html)

---

<div class="post-metadata">

### Author: ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)
#### Post date: [August 23, 2018, 2:07am UTC](https://forum.serverless.com/t/how-to-handle-manual-invoked-aws-lambda/5515/3 "2018-08-23T02:07:02Z")

</div>

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`.

---

<div class="post-metadata">

### Author: ![AaronVasquez](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/aaronvasquez/32/2423_2.png) [@AaronVasquez](https://forum.serverless.com/u/AaronVasquez)
#### Post date: [August 23, 2018, 3:25am UTC](https://forum.serverless.com/t/how-to-handle-manual-invoked-aws-lambda/5515/4 "2018-08-23T03:25:25Z")

</div>

Yeah, this solves my issue. Thanks!
