如何在带有OpenApi连接器的Loopback4中使用自签名证书调用https/rest终结点?是否有允许此类证书的选项?
当我尝试调用service.operation()时,我得到了以下异常:
Unhandled error in GET /user/8f9d1e34-c340-4ebe-af11-fa0c4575f676: 500 FetchError: request to https://localhost:8243/scim2/1.0.0/Users/8f9d1e34-c340-4ebe-af11-fa0c4575f676 failed, reason: unable to verify the first certificate
at ClientRequest.<anonymous> (D:\DEV_BTC\GIT\Foton\PIX\application\composite-services\perfil-usuario-ms\node_modules\node-fetch\lib\index.js:1461:11)
at ClientRequest.emit (events.js:315:20)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)REST Connector的文档提到了一个名为"strictSSL": false的参数,它允许使用自签名的SSL证书。有没有类似于OpenAPI连接器的东西?
谢谢!
发布于 2020-10-11 18:22:32
在打开一个变成问题的bug报告之后,Loopback的团队创建了一个新版本的loopback-connector-openapi to handle this option。
基本上,您需要将此选项添加到数据源config中
const config = {
(...)
httpClientOptions: {
agent: new https.Agent({rejectUnauthorized: false}),
}
(...)
}https://stackoverflow.com/questions/64279939
复制相似问题