Invoke Local doesn't print return object

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.


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

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. Upgrading to a more recent version might help.

Another thing that comes to mind: according to the API Gateway documentation, 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')

I’m getting same problem.

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

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