NODE JS - 客户端网络套接字在建立安全 TLS 连接之前断开连接

NODE JS - Client network socket disconnected before secure TLS connection was established

我在 运行 使用 SDK 生成 PayPal 发票的节点脚本上遇到错误,当它从本地服务器运行时,它工作正常,但当它在生产服务器上运行时,它在下面给出错误:

Uncaught Exception  
{
    "errorType": "Error",
    "errorMessage": "Client network socket disconnected before secure TLS connection was established",
    "code": "ECONNRESET",
    "path": null,
    "host": "api.paypal.com",
    "port": 443,
    "stack": [
        "Error: Client network socket disconnected before secure TLS connection was established",
        "    at TLSSocket.onConnectEnd (_tls_wrap.js:1095:19)",
        "    at Object.onceWrapper (events.js:286:20)",
        "    at TLSSocket.emit (events.js:203:15)",
        "    at TLSSocket.EventEmitter.emit (domain.js:448:20)",
        "    at endReadableNT (_stream_readable.js:1145:12)",
        "    at process._tickCallback (internal/process/next_tick.js:63:19)"
    ]
}

版本详情:

Node Js 10.x, TLS: 1.0

有人遇到过这样的错误吗?

"host": "api.paypal.com",

TLS: 1.0


贝宝需要 TLS 1.2 https://developer.paypal.com/docs/api/info-security-guidelines/#usetls12

如果那是你问题中的错字,而你实际上使用的是 1.2,那么你将不得不更深入地调试它。