In tjbot.js the code block starting on line 429 must be updated. When a new Visual Recognition Service is created (as per May 23, 2018) one gets the following credentials.
And the apikey has to be used as follows (see API Reference):
var visualRecognition = new VisualRecognitionV3({
version: '{version}',
iam_apikey: '{iam_api_key}'
});
Currently the code starting on line 435 in tjbot.js looks like this:
assert(credentials.hasOwnProperty('api_key'), "credentials for the " + service + " service missing 'api_key'");
var VisualRecognitionV3 = require('watson-developer-cloud/visual-recognition/v3');
// see this note about authentication:
// https://www.ibm.com/watson/developercloud/visual-recognition/api/v3/node.html?node#authentication
if (credentials['api_key'] != undefined) {
this._visualRecognition = new VisualRecognitionV3({
api_key: credentials['api_key'],
version: '2018-03-19'
});
} else if (credentials['iam_apikey'] != undefined) {
this._visualRecognition = new VisualRecognitionV3({
api_key: credentials['iam_apikey'],
version: '2018-03-19'
});
} else {
throw new Error(
'No authentication credentials specified for visual_recognition service.');
}
I suggest to change/add the following (another else if):
assert((credentials.hasOwnProperty('api_key') || credentials.hasOwnProperty('apikey')) , "credentials for the " + service + " service missing 'api_key' / 'apikey'");
var VisualRecognitionV3 = require('watson-developer-cloud/visual-recognition/v3');
// see this note about authentication:
// https://www.ibm.com/watson/developercloud/visual-recognition/api/v3/node.html?node#authentication
if (credentials['api_key'] != undefined) {
this._visualRecognition = new VisualRecognitionV3({
api_key: credentials['api_key'],
version: '2018-03-19'
});
} else if (credentials['iam_apikey'] != undefined) {
this._visualRecognition = new VisualRecognitionV3({
api_key: credentials['iam_apikey'],
version: '2018-03-19'
});
} else if (credentials['apikey'] != undefined) {
this._visualRecognition = new VisualRecognitionV3({
iam_apikey: credentials['apikey'],
version: '2018-03-19'
});
} else {
throw new Error(
'No authentication credentials specified for visual_recognition service.');
}
The current TJBot code throws an error when used with a Visual Recognition Service created after May 23, 2018.
In
tjbot.js
the code block starting online 429
must be updated. When a new Visual Recognition Service is created (as per May 23, 2018) one gets the following credentials.And the
apikey
has to be used as follows (see API Reference):Currently the code starting on
line 435
intjbot.js
looks like this:I suggest to change/add the following (another
else if
):The current TJBot code throws an error when used with a Visual Recognition Service created after May 23, 2018.