I am getting
unable to determine the domain name
error when using https.get in node.js application.
My code is below:
const options = {
hostname: hostname,
port: 443,
path: remotePDFFilePath,
method: 'GET'
};
https.get(hostname + remotePDFFilePath, res => {
res.setEncoding("base64");
let body = "";
res.on("data", data => {
body += data;
});
res.on("end", () => {
callback(null, {
status: 1,
response: body.toString('base64')
});
});
});
I have tried searching Google and StackOverflow but did not find any relevant information. I tried changing https module with http but got he same error.
The value for hostname is "subdomain.domain.org" and the value for remotePDFFilePath is "/January Folder/Last, First DocID.pdf".
hostnameandremotePDFFilePathin the debugger, or log those into the console and post the value here?https.get(options, res => {...})instead ofhttps.get(hostname + remotePDFFilePath, res => {...})