相关疑难解决方法(0)

Firebase的云功能 - getaddrinfo ENOTFOUND

尝试使用PayPal-node-SDK向Paypal的API发出请求

exports.requestPayment = functions.https.onRequest((req, res) => {
    return new Promise(function (fullfilled, rejected) {
        paypal.payment.create(create_payment_json, {}, function (error, payment) {
            if (error) {
                rejected(error);
            } else {
                console.log("Create Payment Response");
                console.log(payment);
                res.status(200).send(JSON.stringify({
                    paymentID: payment.id
                })).end();
                fullfilled(payment);
            }
        });
     });
});
Run Code Online (Sandbox Code Playgroud)

但我经常收到一个错误:

Error: getaddrinfo ENOTFOUND api.sandbox.paypal.com api.sandbox.paypal.com:443
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
Run Code Online (Sandbox Code Playgroud)

我试过的事情:

  1. 仍然是向完全不同的主机提出请求 ENOTFOUND
  2. 用包装请求 cors(req,res, ()=>{...})
  3. 预先https://主持人

问题是什么?

dns paypal node.js firebase google-cloud-functions

48
推荐指数
1
解决办法
2万
查看次数

标签 统计

dns ×1

firebase ×1

google-cloud-functions ×1

node.js ×1

paypal ×1