# Invoke Local doesn't print return object

**URL:** <https://forum.serverless.com/t/invoke-local-doesnt-print-return-object/4434>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [May 6, 2018, 12:32am UTC](https://forum.serverless.com/t/invoke-local-doesnt-print-return-object/4434 "2018-05-06T00:32:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmor](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@dmor](https://forum.serverless.com/u/dmor)\
**Post date:** [May 6, 2018, 12:32am UTC](https://forum.serverless.com/t/invoke-local-doesnt-print-return-object/4434/1 "2018-05-06T00:32:03Z")

</div>

I have a simple lambda function which returns a response object as expected for passthrough API Gateway and i’m using AWS and NodeJS 8.10. While testing using `sls invoke local -f <name> --log`, I noticed that Serverless doesn’t output the “response” object.

```
exports.handler = async (event, context) => {
    var response = {
        'statusCode': 200,
        'headers': {
          'customHeader1': 1,
          'customHeader2': 2
        },
        'body': 'Some Value'
    }
   return response
}

```

Is there a way to get this to print without explicitly adding a log statement? I believe it would be very valuable to easily see this while developing.

---

<div class="post-metadata">

**Author:** ![jhslinkman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jhslinkman](https://forum.serverless.com/u/jhslinkman)\
**Post date:** [September 17, 2018, 6:04pm UTC](https://forum.serverless.com/t/invoke-local-doesnt-print-return-object/4434/2 "2018-09-17T18:04:03Z")

</div>

I am also having this problem, though for me it occurs without the `--log` flag. Any insight would be appreciated.

---

<div class="post-metadata">

**Author:** ![teddy-gustiaux](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/teddy-gustiaux/32/2494_2.png) [@teddy-gustiaux](https://forum.serverless.com/u/teddy-gustiaux)\
**Post date:** [September 18, 2018, 1:53am UTC](https://forum.serverless.com/t/invoke-local-doesnt-print-return-object/4434/3 "2018-09-18T01:53:54Z")

</div>

Which version of the Serverless Framework are you using? Support for async functions when using `invoke local` is available since version `1.29.0` according to the [changelog](https://github.com/serverless/serverless/releases/tag/v1.29.0). Upgrading to a more recent version might help.

Another thing that comes to mind: according to the [API Gateway documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-as-simple-proxy-for-lambda.html), the `body` property must be a JSON string when using the Lambda Proxy Integration (which is the case by default for the Serverless Framework). So maybe try this:

`'body': JSON.stringify('Some Value')`

---

<div class="post-metadata">

**Author:** ![hoanguyen311](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/hoanguyen311/32/3259_2.png) [@hoanguyen311](https://forum.serverless.com/u/hoanguyen311)\
**Post date:** [April 30, 2019, 9:02pm UTC](https://forum.serverless.com/t/invoke-local-doesnt-print-return-object/4434/4 "2019-04-30T21:02:24Z")

</div>

I’m getting same problem.

---

<div class="post-metadata">

**Author:** ![stcalica](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/stcalica/32/4070_2.png) [@stcalica](https://forum.serverless.com/u/stcalica)\
**Post date:** [March 20, 2020, 11:23pm UTC](https://forum.serverless.com/t/invoke-local-doesnt-print-return-object/4434/5 "2020-03-20T23:23:23Z")

</div>

I have the same issue with OSX Mojave.

Framework Core: 1.67.0

Plugin: 3.5.0

SDK: 2.3.0

Components: 2.22.3

---

<div class="post-metadata">

**Author:** ![doithuong](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/doithuong/32/3825_2.png) [@doithuong](https://forum.serverless.com/u/doithuong)\
**Post date:** [March 21, 2020, 2:20am UTC](https://forum.serverless.com/t/invoke-local-doesnt-print-return-object/4434/6 "2020-03-21T02:20:19Z")

</div>

I had the same problem, don’t know if you’ve solved it yet?
