I am trying to run this function with OpenWhisk:
def main():
return {"payload": "Hello world"}
With the following:
> bx wsk action create hello_python hello_python.py
> bx wsk action invoke hello_python
When running the function locally a dictionary is returned, but running the above gives this error:
"result": {
"error": "The action did not return a dictionary."
}
What am I missing here?
Change your code to:
def main(args):
return {"payload": "Hello world"}
The Python actions consume and produce a dictionary. Thus you need the "args".