edevregille edevregille - 1 year ago 169
Node.js Question

OpenWhisk invoke watson text to speech action from an action

I am trying to invoke an action included into Watson system package (text to speech) from an OpenWhisk action.

I have binded the service and set-up the credentials and so from the CLI I can see

wsk list
entities in namespace: xxxxxx
/xxxxxx/myWatson private binding

Here is my OpenWhisk action:

function main(param) {
//code here for my action. At the end, I invoke the text to speech

if (...) {
else {
return whisk.error(error);
return whisk.async();

function textToSpeech(text){
payload: text,
voice: 'en-US_MichaelVoice',
accept: 'audio/wav',
encoding: 'base64'
blocking: true,
next: function(error, activation){
return whisk.error(error);
return whisk.done({msg:'success'});

And I get the following error

"response": {
"result": {
"error": "The requested resource does not exist. (undefined)"
"status": "application error",
"success": false

Can you help understanding what I am doing wrong?

Answer Source

The name of the action should be fully qualified to include the namespace. From your CLI output, it looks like your package is /xxxxxx/myWatson so your action reference in the whisk.invoke should be /xxxxxx/myWatson/textToSpeech.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download