Q:

How to get a TEXT response from an IBM serverless function?

I want to use a serverless Function to generate (and expose via a URL) a CSV-like output.
From the documentation I understand 
that this could be achieved using the tag --response-type text. However I am not succedding at it. 
My code is this hello.py script
def main(args):
    text = '1,2,3'
    # json = {'a': [1,2,3]}
    response = text
    return response

(Please note the use the variables text or json to return the proper format, depending on the --response-type tag used to generate the Function.)
I am building the Function as follows:
ibmcloud wsk action delete hello
ibmcloud wsk action create hello hello.py --web true
ibmcloud wsk api create /hello get hello --response-type text

From where I obtain a URL: 
https://service.us.apiconnect.ibmcloud.com/gws/apigateway/api/<GENERATED_API_ID>/hello
But once I hit the URL I get an error:
{
  "error": "There was an error processing your request.",
  "code": "35976969ecfff22ab15b274a5a56e45b"
}

If instead, I return a json from the Function, and create the Function using --response-type json, then
everything works as expected and I get the beautiful JSON on the browser.
Does anyone has an idea what may be going on? 
Note 1: The response will be captured by a service that won't allow (easy) processing of the JSON, and 
from there my need of the CSV format.
Note 2: I found this thread for a very similar topic, and a potential solution. However I do not see how to implement it or use it in my case. 
Thank you all in advance, 
Manuel

A:

The function must always return a JSON object (python dictionary). If you are exposing the function as an API end point, namely an openwhisk web action, then you can return the following response: return { body: text }
Refer to the docs here for more details https://github.com/apache/incubator-openwhisk/blob/master/docs/webactions.md

