4

I am running into strange behavior with IBM Cloud Functions. I have an Action that is web enabled (WebAction) for which I don't require authentication. I use Postman (and a browser) to test this new REST endpoint.(left side of the image below) The result is empty, an actual 204 No Content reponse.

But when I monitor the Action, I can see that it has been invoked and returned the expected JSON (right side of the image below). So the code is executed correctly.

enter image description here

When I perform a commandline invoke:

bx wsk action invoke --result talkToEoffice --param name FunctionWorld

I do see the expected result. Should I provide additional headers ?

Does this have something todo with synchronous (blocking) or non-blocking ?

Community
  • 1
  • 1
mpjjonker
  • 917
  • 1
  • 6
  • 28
  • The activation https://console.bluemix.net/openwhisk/api/activations/ also shows succes as well as the expected response – mpjjonker Jan 08 '18 at 13:05

2 Answers2

7

Looks like you’re returning an object with a property called greeting. For a webaction the response must include a property called body instead. You can nest greeting under body. See https://github.com/apache/incubator-openwhisk/blob/master/docs/webactions.md#handling-http-requests-with-actions for response requirements.

user6062970
  • 831
  • 4
  • 5
0

Try to put extension .json in the end of URL API.

Ex

...API/web/test.json

Or you need explicitly convert some data, for example:

  • you pass {"dealerId:15}, your code need to have

anobject = Int(params['dealerId'])

Return anobject

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 24 '23 at 21:21