Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to pass options when using with node-fetch #13

Open
bmxpiku opened this issue Aug 25, 2023 · 0 comments
Open

Unable to pass options when using with node-fetch #13

bmxpiku opened this issue Aug 25, 2023 · 0 comments

Comments

@bmxpiku
Copy link

bmxpiku commented Aug 25, 2023

Hey,
Im failing to implement this library for node-fetch, and maybe you will have some idea:

import https from 'https';
// @ts-ignore
import { lookup } from 'lookup-dns-cache';

const dnsAgent = (): https.Agent => new https.Agent({
  lookup: lookup(4),
  keepAlive: true,
});

// and then usage within fetch
await fetch(uri, {
      method: 'POST',
      body: JSON.stringify(requestParams),
      headers: { 'Content-Type': 'application/json' },
      agent: dnsAgent,
    });

It fails with an error "options must be an object or an ip version number"
which I see in library code, but passing object {family: 4} also causes same failure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant