Closed ioana-blue closed 7 years ago
result object contains the whole response (of the invocation request) from OpenWhisk. Now, to access the result of the execution, you can directly access it from the nested-object "response". In other words, you can get the result of the action execution as:
ow.actions.invoke({
actionName,
blocking,
params
}).then(invokationResponse => console.log(invokationResponse.response.result))
.catch(error => console.error(error));
So, from your example, to access the reversed string: result.response.reversed
.
I hope this can help.
@tareqmamari Thanks for confirming my understanding. Note that the example above it's not "my" example, it's the example in the documentation of the client here:
https://github.com/openwhisk/openwhisk-client-js#invoke-action-blocking-for-result
which I thought it was wrong (and you confirmed, thanks!)
yes exactly, maybe it will be a good idea to mention that in the docs.
On Feb 15, 2017 4:07 AM, "Ioana Baldini" notifications@github.com wrote:
@tareqmamari https://github.com/tareqmamari Thanks for confirming my understanding. Note that the example above it's not "my" example, it's the example in the documentation of the client here:
https://github.com/openwhisk/openwhisk-client-js#invoke- action-blocking-for-result
which I thought it was wrong (and you confirmed, thanks!)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openwhisk/openwhisk-client-js/issues/29#issuecomment-279904901, or mute the thread https://github.com/notifications/unsubscribe-auth/AFILyGvsnIHFUMYmLqNxsiWaOSz8p6ygks5rcmvzgaJpZM4MA6Gu .
@ioana-blue This should be easy to implement. I'll add it to the list of things to do :)
Is there an option similar to the
-r
in thewsk
cli that returns only the result of the invocation (used together with-b
orblocking = true
)? I'd use it all the time :)On a related note, I don't think I understand how this example in the readme works:
IIUC the result of the invocation will contain not only the "result", but all the other meta data (e.g., duration, name, annotations, etc.) and I would expect
result.reversed
to be undefined. New to js, what am I missing?