Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.2k forks source link

Invoke lambda_handler with event argument #2176

Open manycoding opened 3 years ago

manycoding commented 3 years ago

Context

There's no way to call lambda_handler in the same manner as AWS Lambda test for non-wsgi apps. Related to https://github.com/Miserlou/Zappa/issues/2146 https://github.com/Miserlou/Zappa/pull/983

Expected Behavior

I wanna get an output from the specified lambda_handler function with specified event argument.

zappa invoke dev {"address":"5760 Teredo St., Sechelt, BC, Canada, VON 3A"}

{
  "parsed_address": {
    "street_address": "5760, Teredo St.",
    "city": "Sechelt",
    "state": "BC",
    "postcode": "VON 3A0",
    "country": "Canada"
  }
}

Actual Behavior

Nothing. In fact I cannot get any output even for raw commands: zappa invoke dev 'print("hey")' --raw

Executing a test event from Lambda UI works as expected.

Possible Fix

Allow to

Steps to Reproduce

  1. Create a lambda_handler function with event and context
  2. Specify it in zappa_settings
  3. Zappa invoke from cli

Your Environment