Watson Assistant-UNABLE_TO_GET_ISSUER_CERT_LOCALLY

问题描述 投票:0回答:1

我正在尝试将NodeJS客户端应用程序从公司代理内部本地运行连接到Watson Assistant Service。

要建立连接,我正在使用以下代码。

var HttpsProxyAgent = require('https-proxy-agent');
var httpsAgent = new HttpsProxyAgent("<proxyserver:port>");

var assistant = new AssistantV2({
  version: '2019-02-28',
  authenticator: new IamAuthenticator
     ({apikey: *<apikey here>*, httpsAgent}),
  url: 'https://gateway-wdc.watsonplatform.net/assistant/api',
  disableSslVerification: true,
  httpsAgent,
}); 

但是,我在控制台中收到以下错误

Server running on port: 3100
{ Error: unable to get local issuer certificate
    at RequestWrapper.formatError (*<actual path hidden>*\node_modules\ibm-watson\node_modules\ibm-cloud-sdk-core\lib\request-wrapper.js:208:21)
    at *<actual path hidden>*\node_modules\ibm-watson\node_modules\ibm-cloud-sdk-core\lib\request-wrapper.js:196:25
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
  message: 'unable to get local issuer certificate',
  statusText: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
  body:
   'Response not received - no connection was made to the service.' }

请注意。

node.js ibm-watson watson-assistant
1个回答
0
投票

此问题是由您的代理执行TLS拦截引起的。

您有几种选择:

  1. 设置strict-ssl=false
  2. 设置NODE_EXTRA_CA_CERTS=fullpath_to_certificates_file

对于第一种方法,您将禁用证书验证。在受控环境(您的源代码)中,这可能是好的,但是请确保您知道自己在做什么。

对于第二种方法,请向管理员询问SSL根证书和中间证书。基本上,您是在告诉系统信任那些证书。

© www.soinside.com 2019 - 2024. All rights reserved.