Open liudonghua123 opened 3 months ago
I found it's similar as https://github.com/oven-sh/bun/issues/3386, https://github.com/oven-sh/bun/issues/3371, but maybe not the same exactly.
And the implementation of node-appwrite use node-fetch-native-with-agent
.
See also https://github.com/oven-sh/bun/issues/10642, https://github.com/oven-sh/bun/issues/10834, https://github.com/nodejs/node/issues/48977, https://stackoverflow.com/questions/73817412/why-is-the-agent-option-not-available-in-node-native-fetch, https://bun.sh/docs/runtime/nodejs-apis#node-https.
I found that I can skip this unexpected no-message crash if I comment the following two lines of code in https://github.com/appwrite/sdk-for-node/blob/main/src/client.ts.
// import { createAgent } from 'node-fetch-native-with-agent/agent'; // line 2
// ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }), // line 228
https://github.com/appwrite/sdk-for-node/blob/8113032344a3f29cfd7947cabc14066c7be33320/src/client.ts#L2 https://github.com/appwrite/sdk-for-node/blob/8113032344a3f29cfd7947cabc14066c7be33320/src/client.ts#L228
The first import createAgent
is required even createAgent
is not used, maybe some overwrites made during the import.
What version of Bun is running?
1.1.17
What platform is your computer?
Microsoft Windows [Version 10.0.22631.3810]
What steps can reproduce the bug?
run the following
main.ts
code using the latest bun viabun main.ts
.What is the expected behavior?
working as expected.
What do you see instead?
just exited when invoke the
response = await fetch(uri, options);
in node-appwrite.Additional information
I added some console.info in the implementation of
databases.listDocuments
. And the same code works using node.