Closed andrewxhonson closed 5 years ago
This error is coming from the Watson SDK. Is it still happening? Can you double check that your STT auth credentials are correct, I think this error might happen if the credentials aren't right (e.g. make sure username is the one that looks like 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx').
Also, I just pushed out a new version of the tjbot library that uses a newer version of the Watson SDK. Try upgrading it as well:
cd tjbot/recipes/speech_to_text
rm -rf node_modules
npm install
node stt.js
I get the same error above with the Conversation recipe, even after updating the node_modules. Speech-to-text works incidentally. This is a new install today.
Just to confirm, this is the error you're seeing?
error: the speech_to_text service returned an error. message=WebSocket connection error
return !event.defaultPrevented;
}, _url=wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, _readyState=3, _protocol=undefined, _extensions=, _bufferedAmount=0, _binaryType=arraybuffer, _connection=undefined, , _eventsCount=0, _maxListeners=undefined, maxReceivedFrameSize=1048576, maxReceivedMessageSize=8388608, fragmentOutgoingMessages=true, fragmentationThreshold=16384, webSocketVersion=13, assembleFragments=true, disableNagleAlgorithm=true, closeTimeout=5000, rejectUnauthorized=true, _req=null, protocols=[], origin=null, protocol=wss:, slashes=true, auth=null, host=stream.watsonplatform.net, port=443, hostname=stream.watsonplatform.net, hash=null, search=?model=en-US_BroadbandModel, query=model=en-US_BroadbandModel, pathname=/speech-to-text/api/v1/recognize, path=/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, href=wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, secure=true, base64nonce=REMOVED, onerror=function (event) { self.listening = false; var err = new Error('WebSocket connection error'); err.name = RecognizeStream.WEBSOCKET_CONNECTION_ERROR;
@jweisz I am working on this with @andrewjacobjohnson and I have double checked that the credentials were entered correctly in the config.js file and tried with the newer version of the watson SDK (wiped out node modules and re ran npm install as well). Seem to be running into the same error message.
I had the same problem and while my credentials were correct, they were in the wrong order: i.e. password in the username field. Once I corrected this, things started working.
I had the same problem and while my credentials were correct, they were in the wrong order: i.e. password in the username field. Once I corrected this, things started working.
Unfortunately, I seem to have them in the correct order.
@iambiff Is the file that contains your credentials called config.js? or config.default.js?
@andrewjacobjohnson able to resolve this now with using apikey -- can probably be closed
Read the README.md under the "/tjbot/recipes/speech_to_text" folder. You need to create a copy of the config.default.js file and label it config.js. All you need to do is run a command in the terminal from that folder location as mentioned in the README file:
cp config.default.js config.js
Now you need to edit the credentials of the config.js file. From the credentials on the IBM AI/Watson Speech-to-Text Services page:
{ "apikey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:speech-to-text:XXXXXXX:XXXXXXXXXXXXblah-blah-blahXXXXXXXXXXXXXXXX", "iam_apikey_name": "auto-generated-apikey-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "iam_role_crn": "XXXXXXXXXXblah-blah-blahXXXXXXXXXXX", "iam_serviceid_crn": "XXXXXXXXXblah-blah-blahXXXXXXXXXXX", "url": "https://stream.watsonplatform.net/speech-to-text/api" }
USERNAME: Your username is contained in the _iam_apikeyname entry, but only the XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX section. Exclude the auto-generated-apikey- part of that entry.
"iam_apikey_name": "auto-generated-apikey-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
PASSWORD: Your password/API key is contained in the apikey entry; it should be in this structure, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. You will need to modify the input of the config.js file from password to apikey.
"apikey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
Your config.js file should have the following format:
/*
- User-specific configuration
- IMPORTANT NOTES:
- Please ensure you do not interchange your username and password.
- Your username is the longer value: 36 digits, including hyphens
- Your password is the smaller value: 12 characters */
// Create the credentials object for export exports.credentials = {};
// Watson Speech to Text // https://www.ibm.com/watson/services/speech-to-text/ exports.credentials.speech_to_text = { apikey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', username: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' };
Someone should probably update the Instuctables page to reflect the changes made in the Watson services credentials as well.
Closing due to issue being solved.
After running
sudo tts.js
, I get the following, which loops indefinitely:verbose: TJBot initializing LED
verbose: TJBot initializing microphone
verbose: TJBot initializing speech_to_text service
info: Hello from TJBot! My name is Watson.
verbose: TJBot library version v1.4.0
I understand lots of colors. You can tell me to shine my light a different color by saying 'turn the light red' or 'change the light to green' or 'turn the light off'.
It then starts to loop printing out the following indefinitely (sorry, it won't let me format all of it):
verbose: TJBot initializing microphone WARNING: createRecognizeStream() was renamed to recognizeUsingWebSocket(). Support for createRecognizeStream() will be removed in the next major release error: the speech_to_text service returned an error. message=WebSocket connection error, stack=WebSocket connection error: WebSocket connection error at W3CWebSocket.socket.onerror (/home/pi/Desktop/tjbot/recipes/speech_to_text/node_modules/watson-developer-cloud/lib/recognize-stream.js:201:23) at W3CWebSocket._dispatchEvent [as dispatchEvent] (/home/pi/Desktop/tjbot/recipes/speech_to_text/node_modules/yaeti/lib/EventTarget.js:107:17) at W3CWebSocket.onConnectFailed (/home/pi/Desktop/tjbot/recipes/speech_to_text/node_modules/websocket/lib/W3CWebSocket.js:217:14) at WebSocketClient. (/home/pi/Desktop/tjbot/recipes/speech_to_text/node_modules/websocket/lib/W3CWebSocket.js:59:25)
at emitOne (events.js:116:13)
at WebSocketClient.emit (events.js:211:7)
at WebSocketClient.failHandshake (/home/pi/Desktop/tjbot/recipes/speech_to_text/node_modules/websocket/lib/WebSocketClient.js:339:10)
at ClientRequest. (/home/pi/Desktop/tjbot/recipes/speech_to_text/node_modules/websocket/lib/WebSocketClient.js:278:18)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:544:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)
at TLSSocket.socketOnData (_http_client.js:440:20)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12), name=WebSocket connection error, type=error, isTrusted=false, _yaeti=true, , addEventListener=function _addEventListener(type, newListener) {`
var
listenersType,
i, listener;
}, removeEventListener=function _removeEventListener(type, oldListener) { var listenersType, i, listener;
}, dispatchEvent=function _dispatchEvent(event) { var type, listenersType, dummyListener, stopImmediatePropagation = false, i, listener;
}, _url=wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, _readyState=3, _protocol=undefined, _extensions=, _bufferedAmount=0, _binaryType=arraybuffer, _connection=undefined, domain=null, , _eventsCount=0, _maxListeners=undefined, maxReceivedFrameSize=1048576, maxReceivedMessageSize=8388608, fragmentOutgoingMessages=true, fragmentationThreshold=16384, webSocketVersion=13, assembleFragments=true, disableNagleAlgorithm=true, closeTimeout=5000, rejectUnauthorized=true, _req=null, protocols=[], origin=null, protocol=wss:, slashes=true, auth=null, host=stream.watsonplatform.net, port=443, hostname=stream.watsonplatform.net, hash=null, search=?model=en-US_BroadbandModel, query=model=en-US_BroadbandModel, pathname=/speech-to-text/api/v1/recognize, path=/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, href=wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, secure=true, base64nonce=uS0S8XBjH/qVrUjDfCVt4Q==, onerror=function (event) { self.listening = false; var err = new Error('WebSocket connection error'); err.name = RecognizeStream.WEBSOCKET_CONNECTION_ERROR; err['event'] = event; self.emit('error', err); self.push(null); }, onopen=function () { self.sendJSON(openingMessage); /**
I did pull down the lastest version of the repo but it's still an issue.