'Nodejs Https get Error: getaddrinfo ENOTFOUND
I'm trying to get a filtered record from loopback, but I don't understand why nodejs gives error on fallowing commands:
const https = require('https');
    var uid = '02644da038b37d7ba70b7ee1a92ba1d9';
        var URL = 'https://mobileapp.mydomain.com/api/uuids?filter[where][uuid]='+uid;
https.get(URL, (res) => {
  console.log('statusCode:', res.statusCode);
  console.log('headers:', res.headers);    
  res.on('data', (d) => {
    process.stdout.write(d);
  });
}).on('error', (e) => {
  console.error('ERROR:',e);
});
the error on output:
ERROR: { Error: getaddrinfo ENOTFOUND mobileapp.mydomain.com mobileapp.mydomain.com:443
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:79:26)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'mobileapp.mydomain.com',
  host: 'mobileapp.mydomain.com',
  port: 443 }
							
						Solution 1:[1]
Obviously the domain you used is not valid.
Solution 2:[2]
probably it's because of SSL authentication in loopback, can you please try this npm package
Solution 3:[3]
URL shouldn't contain https://
modify url 
from
var URL = 'https://mobileapp.mydomain.com/api/uuids?filter[where][uuid]='+uid; 
 to var URL = 'mobileapp.mydomain.com/api/uuids?filter[where][uuid]='+uid;
I had this issue and this resolved it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | A-yon Lee | 
| Solution 2 | |
| Solution 3 | 
