Support the Bun.js Runtime
I would be nice to support the bun.js runtime, but we'll first need to wait for these bun.js issues to be addressed:
- https://github.com/oven-sh/bun/issues/14498
- https://github.com/oven-sh/bun/issues/4145
+1
main blocker AFAICT is https://github.com/oven-sh/bun/issues/4474 as we rely on passing a custom Dispatcher to manage the underlying socket
it seems bun just ignores undici agent (https://github.com/oven-sh/bun/issues/10642) which we rely on to support various transport protocols. Support for unix domain socket is available using non-standard 🤨 RequestInit.unix attribute (https://bun.com/docs/guides/http/fetch-unix) and I can get most tests (see next) to pass using this hack. We could also pass custom TLS certificates (https://bun.com/docs/runtime/networking/fetch#tls). We would still miss support for windows npipe and ssh. Sounds like a hack anyway, not sane foundations to work with IMHO 😖
bun overrides undici dependency with a custom implementation 🤪, basically just forwarding to the internal fetch API which is missing upgrade support:
error: This function is not yet implemented in Bun
at notImplemented (undici:13:14)
at upgrade (undici:124:17)
this is not strictly needed as engine will accept a plain POST request, but could be required by proxies in some context
tested a (partial) and hack-ish support for bun: https://github.com/docker/node-sdk/pull/59 tests failing for weird reason