fix: patch node-fetch-native-with-agent to bypass bundled undici on Node 26
node-appwrite 23.1.0 ships a bundled undici Agent via node-fetch-native-with-agent. That bundle uses an older undici dispatcher API that crashes on Node 26 with 'invalid onError method' (UND_ERR_INVALID_ARG), making every Appwrite call fail with 'fetch failed' / our user-facing 'Bağlantı hatası' fallback. The patch replaces createAgent/createFetch with thin pass-throughs to globalThis.fetch — Node native fetch handles HTTPS to db.kovaksoft.com directly, no proxy/agent customization needed. Verified end-to-end via users.listMemberships against the live project. Also added dev-mode error surfacing in appwriteError so future SDK exceptions show the real message instead of 'Bağlantı hatası'.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
diff --git a/dist/agent.cjs b/dist/agent.cjs
|
||||
index c623b82a03edb5e2c3423c36c9ee235f6ae74325..d2a0dcac815310b72fba4726f5b9023ff498f1af 100644
|
||||
--- a/dist/agent.cjs
|
||||
+++ b/dist/agent.cjs
|
||||
@@ -1 +1,13 @@
|
||||
-"use strict";var u=Object.defineProperty;var o=(e,t)=>u(e,"name",{value:t,configurable:!0});const http=require("node:http"),https=require("node:https"),index=require("./shared/node-fetch-native-with-agent.df7e6bd6.cjs"),nodeFetchNativeWithAgent=require("node-fetch-native-with-agent");require("node:assert"),require("node:net"),require("node:stream"),require("node:buffer"),require("node:util"),require("node:querystring"),require("node:diagnostics_channel"),require("node:events"),require("./shared/node-fetch-native-with-agent.61758d11.cjs"),require("node:tls"),require("node:zlib"),require("node:perf_hooks"),require("node:util/types"),require("node:os"),require("node:url"),require("node:async_hooks"),require("node:console"),require("string_decoder"),require("node:worker_threads");var i=Object.defineProperty,r=o((e,t)=>i(e,"name",{value:t,configurable:!0}),"r");function createAgent(e,t={}){const n={rejectUnauthorized:t.rejectUnauthorized},c=e?.startsWith("https:")?new https.Agent(n):new http.Agent,s=new index.Agent_1({connect:n});return{agent:c,dispatcher:s}}o(createAgent,"createAgent"),r(createAgent,"createAgent");function createFetch(e={}){const t=createAgent(void 0,e);return(n,c)=>nodeFetchNativeWithAgent.fetch(n,{...t,...c})}o(createFetch,"createFetch"),r(createFetch,"createFetch");const fetch=createFetch({});exports.createAgent=createAgent,exports.createFetch=createFetch,exports.fetch=fetch;
|
||||
+"use strict";
|
||||
+// Patched: bypass bundled undici Agent that crashes on Node 26 (UND_ERR_INVALID_ARG).
|
||||
+// node-appwrite calls createFetch()(url, opts); route to native global fetch.
|
||||
+function createAgent() {
|
||||
+ return {};
|
||||
+}
|
||||
+function createFetch() {
|
||||
+ return (input, init) => globalThis.fetch(input, init);
|
||||
+}
|
||||
+const fetch = (input, init) => globalThis.fetch(input, init);
|
||||
+exports.createAgent = createAgent;
|
||||
+exports.createFetch = createFetch;
|
||||
+exports.fetch = fetch;
|
||||
diff --git a/dist/agent.mjs b/dist/agent.mjs
|
||||
index ef96ec1e9791791736856775a81383dd02d52e40..a5e381da653086facdaec519a84de065a4bbf1aa 100644
|
||||
--- a/dist/agent.mjs
|
||||
+++ b/dist/agent.mjs
|
||||
@@ -1 +1,9 @@
|
||||
-var a=Object.defineProperty;var o=(t,r)=>a(t,"name",{value:r,configurable:!0});import{Agent as f}from"node:http";import{Agent as h}from"node:https";import{A as s}from"./shared/node-fetch-native-with-agent.56860586.mjs";import{fetch as g}from"node-fetch-native-with-agent";import"node:assert";import"node:net";import"node:stream";import"node:buffer";import"node:util";import"node:querystring";import"node:diagnostics_channel";import"node:events";import"./shared/node-fetch-native-with-agent.1a4a356d.mjs";import"node:tls";import"node:zlib";import"node:perf_hooks";import"node:util/types";import"node:os";import"node:url";import"node:async_hooks";import"node:console";import"string_decoder";import"node:worker_threads";var u=Object.defineProperty,p=o((t,r)=>u(t,"name",{value:r,configurable:!0}),"r");function m(t,r={}){const e={rejectUnauthorized:r.rejectUnauthorized},i=t?.startsWith("https:")?new h(e):new f,c=new s({connect:e});return{agent:i,dispatcher:c}}o(m,"createAgent"),p(m,"createAgent");function n(t={}){const r=m(void 0,t);return(e,i)=>g(e,{...r,...i})}o(n,"createFetch"),p(n,"createFetch");const A=n({});export{m as createAgent,n as createFetch,A as fetch};
|
||||
+// Patched: bypass bundled undici Agent that crashes on Node 26 (UND_ERR_INVALID_ARG).
|
||||
+function createAgent() {
|
||||
+ return {};
|
||||
+}
|
||||
+function createFetch() {
|
||||
+ return (input, init) => globalThis.fetch(input, init);
|
||||
+}
|
||||
+const fetch = (input, init) => globalThis.fetch(input, init);
|
||||
+export { createAgent, createFetch, fetch };
|
||||
Reference in New Issue
Block a user