简体   繁体   English

IBM Watson对话-无法将node.js连接到Watson对话

[英]IBM Watson Conversation - Unable to connect node.js to watson conversation

I have a Problem with an IBM Watson Conversation Application. 我对IBM Watson Conversation Application有问题。

I have my Application set up and try to connect it to my node.js Application. 我已经设置了我的应用程序,并尝试将其连接到我的node.js应用程序。 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. 我在这里关注本教程: https : //github.com/watson-developer-cloud/node-sdk#conversation,并且我使用的是ibm ibm提供的官方api。

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 最好,本

Bluemix has a number of regions where you can host services. Bluemix有许多可以托管服务的区域。 There are different gateways into each region. 每个区域都有不同的网关。 By default it is https://gateway.watsonplatform.net . 默认情况下为https://gateway.watsonplatform.net

For Germany + France Regions you would set the following URL variable in the code: 对于德国+法国地区,您可以在代码中设置以下URL变量:

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. 对于其他区域,您可以进入Watson对话服务凭据以查看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'). 这是修订后的Watson Assistant的IBM Cloud API的链接,其中包括node.js的代码示例和URL列表(请参阅“服务端点”)。

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){

});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM