Loopback4使用自签名证书调用HTTPS/REST服务

Loopback4使用自签名证书调用HTTPS/REST服务,loopback4,Loopback4,如何使用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-af1

如何使用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)
GET/user/8f9d1e34-c340-4ebe-af11-fa0c4575f676中未处理的错误:500 FetchError:请求https://localhost:8243/scim2/1.0.0/Users/8f9d1e34-c340-4ebe-af11-fa0c4575f676失败,原因:无法验证第一个证书 在ClientRequest。提到一个名为
“strictSSL”的参数:false
,以允许自签名SSL证书。有类似于OpenAPI连接器的东西吗


谢谢大家!

在打开一个引起质疑的bug报告和一个功能请求后,Loopback的团队创建了一个新版本的
环回连接器openapi

基本上,您需要将此选项添加到数据源
config

const config = {
  (...)
  httpClientOptions: {
    agent: new https.Agent({rejectUnauthorized: false}),
  }
  (...)
}