Node.js # https配置错误导致的报错:Error: self signed certificate

在使用Node.js的request模块发起POST请求时遇到'Error: self signed certificate'错误。该错误源于API服务器SSL配置问题。为了解决这个问题,需要在代码中禁用SSL校验。关键代码示例已给出。
摘要由CSDN通过智能技术生成

使用Nodejs request发起Post请求 multipart/form-data

并且遇到了
在这里插入图片描述
这个报错


问题其实是api的ssl配置有问题,因此这里取消对ssl的校验

下图关键代码:

rejectUnauthorized:false
const fs = require('fs');
const</
(node:17764) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version. (Use `node --trace-deprecation ...` to show where the warning was created) ConnectionError: Failed to connect to 192.168.10.223:1433 - self signed certificate at D:\FangcloudV2\servodynamics\SystemDevelop\plugin-code\node_modules\mssql\lib\tedious\connection-pool.js:70:17 at Connection.onConnect (D:\FangcloudV2\servodynamics\SystemDevelop\plugin-code\node_modules\tedious\lib\connection.js:1012:9) at Object.onceWrapper (node:events:642:26) at Connection.emit (node:events:527:28) at Connection.emit (D:\FangcloudV2\servodynamics\SystemDevelop\plugin-code\node_modules\tedious\lib\connection.js:1040:18) at Connection.socketError (D:\FangcloudV2\servodynamics\SystemDevelop\plugin-code\node_modules\tedious\lib\connection.js:1395:12) at D:\FangcloudV2\servodynamics\SystemDevelop\plugin-code\node_modules\tedious\lib\connection.js:2402:25 at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: 'ESOCKET', originalError: ConnectionError: Failed to connect to 192.168.10.223:1433 - self signed certificate at Connection.socketError (D:\FangcloudV2\servodynamics\SystemDevelop\plugin-code\node_modules\tedious\lib\connection.js:1395:28) at D:\FangcloudV2\servodynamics\SystemDevelop\plugin-code\node_modules\tedious\lib\connection.js:2402:25 at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: 'ESOCKET', isTransient: undefined }
07-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

真·skysys

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值