Open andycitron opened 6 years ago
HI @andycitron
The vision serviced is called via the vision api nodejs api. Behind the scenes, it hits the same api. Can you share some code, or a picture of the error you receive?
Victor.
Here's (part of) the exception that is thrown:
A photo is saved as photos/pic_0.jpg with exit code, 0
{ Error: Unauthorized: Access is denied due to invalid credentials.
at Request._callback (/home/pi/Desktop/tjbot/recipes/tjvision/tjvision-master/node_modules/watson-developer-cloud/lib/requestwrapper.js:97:15)
at Request.self.callback (/home/pi/Desktop/tjbot/recipes/tjvision/tjvision-master/node_modules/request/request.js:186:22)......
I'm running the code tjvision that is part of this package. I have updated the credential in config.js: exports.VisionKey = 'same key used successfully on the CURL request' ; exports.VisionVersion = '2016-05-19' ;
The key is for the service: Visual Recognition : Visual Recognition-xa
Here's what the credentials look like (with the actual key obfuscated): { "apikey": "••••••••••••••••••••••••••••••••••••••••••••", "iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:watson-vision-combined:us-south:a/6c5d7294daab55d494e47feadce57cd1:5b72d0b0-74cf-41ad-8b9e-a818cbbaf245::", "iam_apikey_name": "auto-generated-apikey-10880bd4-6581-433a-acd3-4b94a6ab3669", "iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Manager", "iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/6c5d7294daab55d494e47feadce57cd1::serviceid:ServiceId-7428e64b-bc40-435a-8bd4-628aacf030d6", "url": "https://gateway.watsonplatform.net/visual-recognition/api" }
Is this the right service to be using? Is that an iam_api key that needs to be specified differently? There seems to be a difference in the way the key is specified on the CURL request: apiKey vs api_key.
I've tried a number of differnent combinations with no luck.
Thanks for the help. Andy
It seems to me that that vision api nodejs api code that was installed with the tjvision project is not compatible with the current level of the service. The api docs indicate that to instantiate a newer version of the vision service, the following should be used:
var visual_recognition = new VisualRecognitionV3({
url: config.VisionUrl,
version: config.VisionVersion,
iam_apikey: config.VisionKey
});
But when running this, the installed v3 code throws an exception because it wants api_key to be specified. The same code also don't like 'version' to be specified.
So I'm guessing the v3 that gets installed by node install is back level. Do you agree? How do I get an updated version that is compatible with tjvision.js.
I see from poking around that others are having similar issues. I haven't found the solution yet.
I've tried modifying the v3 code to work around the problem, but have not succeeded.
I have created a visual recognition service, and I'm pretty sure I entered the correct credentials into config.js, but I have feeling I'm supposed to use a watson developer cloud credential. I'm running this on a raspberry pi (tjbot). I'm able to run the CURL POST specifying apikey, successfully. But that is directly to the service: https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify?version=2018-03-19. I have a feeling the node code used by this tjvision project is not going directly to that api. Please describe the service setup I need to have in place to get this node.js code to work.
thanks