2018 Sun May 13

  • Another Python tool came to my attention: https://pyre-check.org. Released a few days ago by Facebook.

  • Its easy to test local functions out with serverless, for example the following was simply run in the root of a lambda project:

     sls invoke local --function on_message_2 --stage dev --data '{"a": 1}'
    {"timestamp": "2018-05-13 23:44:42,744", "level": "DEBUG", "location": "countdown.on_message.on_message:14", "message": {"event": {"a": 1}}, "request_id": "1234567890"}
    
    {
        "statusCode": 200,
        "body": "{}"
    }
  • To log JSON out of a lambda just make sure that whatever you output to stdout is compliant JSON. Example in Python (note the values must of course be JSON serializable):

    log.debug(json.dumps({'event': event}))
  • AWS Lambda HTTP handler simply returns JSON like the following to respond:

return {
  'statusCode': 200,
  'body': '{}'
}