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
packages
/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 (...) {
textToSpeech(param.text);
}
else {
return whisk.error(error);
}
return whisk.async();
}
function textToSpeech(text){
whisk.invoke({
name:'myWatson/textToSpeech',
parameters:{
payload: text,
voice: 'en-US_MichaelVoice',
accept: 'audio/wav',
encoding: 'base64'
},
blocking: true,
next: function(error, activation){
if(error){
return whisk.error(error);
}
else{
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?
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
.