Ensure happy-eyeballs uses supervisor dns lookup

Happy-eyeballs performs [dns lookups](https://github.com/balena-io-modules/happy-eyeballs/blob/master/src/happy-eyeballs.ts#L23)
for the requested addresses, however, because of the order of imports it
was not using the supervisor custom `dns.lookup` that handles `.local`
name resolution, making address resolution fail in those cases.

Moving the import after the `dns.lookup` patch fixes the problem.
This commit is contained in:
Felipe Lalanne 2021-12-16 11:37:35 -03:00
parent 39c667803d
commit 08147e6a86

View File

@ -1,6 +1,5 @@
import { NOTFOUND } from 'dns';
import * as mdnsResolver from 'mdns-resolver';
import '@balena/happy-eyeballs/eye-patch';
class DnsLookupError extends Error {
public constructor(public code: string = NOTFOUND) {
@ -118,6 +117,7 @@ interface DnsLookupOpts {
};
})();
import '@balena/happy-eyeballs/eye-patch';
import Supervisor from './supervisor';
const supervisor = new Supervisor();