Reputation: 36
I have a Problem with an IBM Watson Conversation Application.
I have my Application set up and try to connect it to my node.js Application. I’m following this tutorial here: https://github.com/watson-developer-cloud/node-sdk#conversation and i am using the official node.js api ibm provides.
Unfortunately it does not work and i get following error.
{ Error: Not Authorized
at Request._callback (/Volumes/hd2/Projekte/vi-com-bot-service/node_modules/watson-developer-cloud/lib/requestwrapper.js:87:15)
at Request.self.callback (/Volumes/hd2/Projekte/vi-com-bot-service/node_modules/watson-developer-cloud/node_modules/request/request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/Volumes/hd2/Projekte/vi-com-bot-service/node_modules/watson-developer-cloud/node_modules/request/request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/Volumes/hd2/Projekte/vi-com-bot-service/node_modules/watson-developer-cloud/node_modules/request/request.js:1091:12)
at IncomingMessage.g (events.js:291:16)
at emitNone (events.js:91:20)
code: 401,
error: 'Not Authorized',
description: '2017-06-01T08:57:57-04:00, Error ERCDPLTFRM-DNLKUPERR occurred when accessing https://gateway.watsonplatform.net/conversation/api/v1/workspaces/dc8097e8-fea7-47a3-80ed-57c43321377e/message?version=2017-04-21, Tran-Id: gateway-dp01-2475007148 - Invalid UserId and/or Password. Please confirm that your credentials match the end-point you are trying to access. A common error is trying to use credentials from an experimental or beta release against a GA release or vice versa' }
The Credentials i provide are correct.
Do you have ay idea, why i does not work? Best, ben
Upvotes: 1
Views: 1265
Reputation: 101
Bluemix has a number of regions where you can host services. There are different gateways into each region. By default it is https://gateway.watsonplatform.net
.
For Germany + France Regions you would set the following URL variable in the code:
url: 'https://gateway-fra.watsonplatform.net/conversation/api/'
Like so:
var conversation = new ConversationV1({
username: '<username>',
password: '<password>',
url: 'https://gateway-fra.watsonplatform.net/conversation/api/',
version_date: ConversationV1.VERSION_DATE_2017_05_26
});
For other regions, you can go into the Watson conversation service credentials to see the URL. Or the conversation workspace "Deploy" then "Credentials" section.
This is the link to the revised IBM Cloud API for Watson Assistant including code samples for node.js and a list of URLs (see 'Service Endpoint').
Upvotes: 2
Reputation: 21
var ConversationV1= require('watson-developer-cloud/conversation/v1');
var conversation = new ConversationV1({
username:'<username>',
password: '<Password>',
version_date: 'Date'
});
conversation.message({
workspace_id:'<Workspace Id>',
context: userContext,
input: {
"text": "<text>"
}
},function(err,resp){
});
Upvotes: 0