Open mrturck opened 2 months ago
Can you check your package.lock file to see which version of the undici
dependency was installed? As far as I know this isn't a new API in undici
, but good to double check that.
Using bun, but here's what bun.lockb has:
"@turbopuffer/turbopuffer@^0.5.10":
version "0.5.10"
resolved "https://registry.npmjs.org/@turbopuffer/turbopuffer/-/turbopuffer-0.5.10.tgz"
integrity sha512-tQgouaKZPEMSf1y1p6lksmgRZ+Toj248AkPxiCdsZNoHVDWVTZgXHLet9cie4cz4oAaaVE0NWkoMyO0KafFuRA==
dependencies:
pako "^2.1.0"
undici "^6.19.8"
Got it. The SDK definitely works in node, but I was able to reproduce the issue in bun.
It looks like bun is trying to polyfill undici in their environment, but it only has partial support. For example, they implemented undici.request in https://github.com/oven-sh/bun/pull/2136 but only on the module level, not on the Agent/Dispatcher.
The reason we use undici.Agent.request
is that this allows fine tuned configuration of the connection pool and request options, and in our customer's large scale node deployments we've been able to achieve a significant performance improvement over both node's built in fetch
and undici.fetch
I'm guessing that bun's fetch implementation is just a lot better than node's. This issue boils down to just using fetch in non-node environments https://github.com/turbopuffer/turbopuffer-typescript/issues/20
By the way, the official stance of bun is to be compatible directly with node https://twitter.com/jarredsumner/status/1700497869160268155
It looks like other libraries are using undici.Pool.request, which is also unimplemented https://github.com/NomicFoundation/hardhat/issues/4383 https://github.com/oven-sh/bun/issues/7920, and it's an open issue to fix in bun.
But we will work around it in the turbopuffer client anyway, as we want to support all JS environments, not just node.
Hello I am getting this error when using the Typescript SDK, full error below
Details: