Log that first argument to dns.lookup(); it’s not just the hostname as the function requires. There was another similar problem just today about this. Your code is flagging all URLs as invalid.
Also, be careful about mixing async/await and a callback (the second argument to dns.lookup(). Either use the callback version or use the async version.
Google the dns.lookup() documentation for more details.