错误:getaddrinfo ENOTFOUND使用量角器的节点JS(已解决)

问题描述 投票:0回答:1

我正在使用此方法来请求tokenDn

this.retornaTokenDnQA  = function (Request, tokenAuth) {
        return new Promise((resolve, reject) => {
            Request.get({
                    "headers": { "content-type": "application/json", "Authorization": "Bearer " + tokenAuth }, 
                    "url": "https://urlqa-api.apps.pd01e.edc1.cf.company.com/transformation/api/jwt/generate",
                    "body": JSON.stringify({
                        "dn": "5094",
                        "claims": {
                            "country": "BRA",
                            "division": 1,
                            "user": "ULSCA301",
                            "roles": [
                                "agenda - Distribuidor",
                                "teste - teste"
                            ],
                            "locale": {
                                "language": "pt",
                                "region": "BR"
                            }
                        }
                    })
                }, (error, response, body) => {
                if (error) {
                    return console.dir(error); 
                }
                //console.log("inside: " + response.body);
                resolve(response.body);
            });
        });
    };//end function - retornaTokenDn

但是这会返回以下错误消息。

Error: getaddrinfo ENOTFOUND urlqa-api.apps.pd01e.edc1.cf.company.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26) {
  errno: 'ENOTFOUND',
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'urlqa-api.apps.pd01e.edc1.cf.company.com'
}

**真正的问题是,仅当我使用VPN连接来连接网络公司时才会发生此错误。使用我的家庭网络可以正常工作。**

或者当我使用vpn并由邮递员使用相同选项发送请求时,响应为200,确定。

我正在量角器自动测试中使用此方法,感谢您能提供的任何帮助。谢谢!!

我正在使用此方法来请求tokenDn this.retornaTokenDnQA =函数(Request,tokenAuth){return new Promise((resolve,reject)=> {Request.get({...

node.js request protractor
1个回答
0
投票
如果ENOTFOUND错误取决于您的网络,我将检查其中一个网络中是否有代理服务器。
© www.soinside.com 2019 - 2024. All rights reserved.