Skip to content

Commit f05776e

Browse files
committed
Visual Recognition bound unbound key fix
1 parent a83bb66 commit f05776e

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Node-RED Watson Nodes for IBM Cloud
1818
- Natural Language Classifier updated for use of IAM key for authentication.
1919
- Fix the Natural Language Understanding for bound IAM key service.
2020
- German is a supported STT Language.
21+
- Visual Recognition Key fix when migrating from unbound to bound service.
2122

2223
### New in version 0.7.3
2324
- Modify Discovery Query Builder Node to use `listCollectionFields` to determine query list.

services/visual_recognition/v3.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@
163163
category: 'IBM Watson',
164164
defaults: {
165165
name: {value: ""},
166-
apikey: {value: ""},
167166
'vr-service-endpoint' :{value: 'https://gateway-a.watsonplatform.net/visual-recognition/api'},
168167
"image-feature": {value: ""},
169168
"lang": {value: ""},
@@ -232,7 +231,6 @@
232231
category: 'IBM Watson',
233232
defaults: {
234233
name: {value: ""},
235-
apikey: {value: ""},
236234
'vr-service-endpoint' :{value: 'https://gateway-a.watsonplatform.net/visual-recognition/api'},
237235
"image-feature": {value: ""}
238236
},

services/visual_recognition/v3.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = function(RED) {
4040
async = require('async'),
4141
toArray = require('stream-to-array'),
4242
sAPIKey = null,
43+
apikey = '',
4344
iamAPIKey = false,
4445
service = null,
4546
endpoint = '',
@@ -152,8 +153,8 @@ module.exports = function(RED) {
152153
function verifyServiceCredentials(node, msg) {
153154
// If it is present the newly provided user entered key
154155
// takes precedence over the existing one.
155-
node.apikey = sAPIKey || node.credentials.apikey;
156-
if (!node.apikey) {
156+
apikey = sAPIKey || node.credentials.apikey;
157+
if (!apikey) {
157158
return Promise.reject('Missing Watson Visual Recognition API service credentials');
158159
}
159160

@@ -170,9 +171,9 @@ module.exports = function(RED) {
170171

171172
// VR instances created post 22 May 2018, are expecting an iam API Key
172173
if (iamAPIKey) {
173-
serviceSettings.iam_apikey = node.apikey;
174+
serviceSettings.iam_apikey = apikey;
174175
} else {
175-
serviceSettings.api_key = node.apikey;
176+
serviceSettings.api_key = apikey;
176177
}
177178

178179
// The change to watson-developer-cloud 3.0.x has resulted in a

0 commit comments

Comments
 (0)