0

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?

data_henrik
  • 16,724
  • 2
  • 28
  • 49
Margriet
  • 35
  • 6

2 Answers2

2

Change your code to:

def main(args):
    return {"payload": "Hello world"}

The Python actions consume and produce a dictionary. Thus you need the "args".

data_henrik
  • 16,724
  • 2
  • 28
  • 49
0

main() input can't be empty takes a dict like main(args)

def main(args):
    return {"payload": "Hello world"}
csantanapr
  • 5,002
  • 2
  • 19
  • 15