Maarrk
Maarrk
DDeno
Created by Maarrk on 2/11/2024 in #help
Error with fetch called from npm module
I am trying to use the tsdav NPM package with Deno, and have run into a problem with making an HTTP request, which seems specific to Deno. When I try to call any request method from the library, I get an error with HttpsClientRequest somewhere deep within some compatibility layer:
error: TypeError: Cannot read properties of undefined (reading 'write')
at HttpsClientRequest._writeRaw (ext:deno_node/_http_outgoing.ts:422:24)
at HttpsClientRequest._send (ext:deno_node/_http_outgoing.ts:408:17)
at HttpsClientRequest.write_ (ext:deno_node/_http_outgoing.ts:316:16)
at HttpsClientRequest.write (ext:deno_node/_http_outgoing.ts:293:17)
at writeToStream (file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/node-fetch/2.7.0/lib/index.js:654:8)
at file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/node-fetch/2.7.0/lib/index.js:1726:3
at new Promise (<anonymous>)
at Function.fetch (file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/node-fetch/2.7.0/lib/index.js:1447:9)
at Function.fetch (file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/cross-fetch/4.0.0/dist/node-ponyfill.js:10:20)
at file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/tsdav/2.0.7/dist/tsdav.cjs.js:198:42
error: TypeError: Cannot read properties of undefined (reading 'write')
at HttpsClientRequest._writeRaw (ext:deno_node/_http_outgoing.ts:422:24)
at HttpsClientRequest._send (ext:deno_node/_http_outgoing.ts:408:17)
at HttpsClientRequest.write_ (ext:deno_node/_http_outgoing.ts:316:16)
at HttpsClientRequest.write (ext:deno_node/_http_outgoing.ts:293:17)
at writeToStream (file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/node-fetch/2.7.0/lib/index.js:654:8)
at file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/node-fetch/2.7.0/lib/index.js:1726:3
at new Promise (<anonymous>)
at Function.fetch (file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/node-fetch/2.7.0/lib/index.js:1447:9)
at Function.fetch (file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/cross-fetch/4.0.0/dist/node-ponyfill.js:10:20)
at file:///C:/Users/Marek/AppData/Local/deno/npm/registry.npmjs.org/tsdav/2.0.7/dist/tsdav.cjs.js:198:42
Possibly relevant links: - The tsdav library: https://tsdav.vercel.app/ https://www.npmjs.com/package/tsdav - Implementation of fetch that gets called by them: https://www.npmjs.com/package/node-fetch - The test showing this error: https://github.com/Maarrk/silverbullet-carddav/blob/ed209cb939b935cfe50169dbff7ba8ed2df7771c/online.test.ts#L27-L30 I've only used Deno for a few weeks but I really like it so far, thanks in advance for any help or pointers to relevant docs 😊 I couldn't even find the _http_outgoing.ts in my local deno folder on my own...
4 replies