简体   繁体   中英

Error: getaddrinfo ENOTFOUND Node JS using protractor

I'm using this method to request a 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

but this return the following erro message.

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'
}

** The real problema is, this error only occur when I'm using a VPN connection to connect the network company. Using my home network this work normally.**

Or when I'm using vpn and send a request by postman using the same options the response is 200, ok.

I'm using this method in a protractor automated test, I apreciate any help u can do. Thanks!!!

if the ENOTFOUND error is dependent on your network, I'd check if there is a proxy server in one of the networks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM