You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone, I have a bit of a weird issue.. Long story short, I'm doing something a little weird, and I need to be able to override DNS resolution when doing HTTP requests. I already have an implementation based on fetch-h2 and node-fetch which works when running on Node.js. I'm using fetch-h2 and node-fetch because Node.js's fetch() implementation doesn't allow me to override DNS resolution - same as Bun's; fetch-h2 had some kind of problem with HTTP-only requests, so I'm using it only for HTTPS / HTTP2, and node-fetch handles HTTP requests. And even though it's a little convoluted, it does work in Node.
But it doesn't work in Bun. Well, the DNS overriding doesn't work, the rest works pretty well. With both libraries, I'm able to pass in a lookup() callback which allows me to hook into the DNS resolution process. Going by TypeScript typings, it looks like both libraries pass this callback through to underlying TCP / TLS layers of Node.. which are probably implemented somewhat differently in Bun, and possibly in a way which doesn't call the provided callback - I'm assuming it's to make the DNS caching / prefetching work?
Anyway - I'd be surprised if there was a way to work around this right now, but since Bun aims at drop-in compatibility with Node, I thought I'd ask anyway..?
(I can't put the overrides in /etc/hosts, in case anyone wonders.)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone, I have a bit of a weird issue.. Long story short, I'm doing something a little weird, and I need to be able to override DNS resolution when doing HTTP requests. I already have an implementation based on
fetch-h2
andnode-fetch
which works when running on Node.js. I'm usingfetch-h2
andnode-fetch
because Node.js'sfetch()
implementation doesn't allow me to override DNS resolution - same as Bun's;fetch-h2
had some kind of problem with HTTP-only requests, so I'm using it only for HTTPS / HTTP2, andnode-fetch
handles HTTP requests. And even though it's a little convoluted, it does work in Node.But it doesn't work in Bun. Well, the DNS overriding doesn't work, the rest works pretty well. With both libraries, I'm able to pass in a
lookup()
callback which allows me to hook into the DNS resolution process. Going by TypeScript typings, it looks like both libraries pass this callback through to underlying TCP / TLS layers of Node.. which are probably implemented somewhat differently in Bun, and possibly in a way which doesn't call the provided callback - I'm assuming it's to make the DNS caching / prefetching work?Anyway - I'd be surprised if there was a way to work around this right now, but since Bun aims at drop-in compatibility with Node, I thought I'd ask anyway..?
(I can't put the overrides in
/etc/hosts
, in case anyone wonders.)Beta Was this translation helpful? Give feedback.
All reactions