bun
bun copied to clipboard
Implement some `undici` APIs
Implementing these two classes in undici will unblock libraries like discord.js and @elastic/elasticsearch (as mentioned here: https://github.com/oven-sh/bun/issues/1749#issuecomment-1413262351)
- [x]
undici.Agent - [x]
undici.Pool - [x]
undici.request(Required fordiscord.js) - [ ]
undici.Pool.request(Probably just calls undici.request polyfill)
We can polyfill it, like with http.Agent
We can polyfill it, like with http.Agent
Yeah is undici fetch just re-exporting global fetch? So basically we would just need to stub these two classes out?
Exactly
68 | }
69 |
70 | async arrayBuffer() {
71 | this.#consume();
72 |
73 | return await this.#response.arrayBuffer();
^
TypeError: undefined is not a function
at undici:73:17
at arrayBuffer (undici:71:22)
at parseResponse (/home/whynotdogie/dev/nodejs/discordjs/freart/node_modules/@discordjs/rest/dist/index.js:493:29)
I assume that this is being fixed.
49 | enumerable: true,
50 | configurable: true,
51 | writable: true,
52 | value: void 0
53 | });
54 | Error.captureStackTrace(this, ConnectionError);
^
ConnectionError: Not implemented in bun
at new ConnectionError (/home/username/project/api/node_modules/@elastic/transport/lib/errors.js:54:8)
at /home/username/project/api/node_modules/@elastic/transport/lib/Transport.js:528:30
at processTicksAndRejections (:1:2602)
Bun Version :1.0.0 @elastic/elasticsearch : ^8.6.0
Having this Error
These were all implemented. If you run into a "Not implemented" error, please open another issue so we can track it.