ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.43k stars 1.25k forks source link

ipfs-http-client doesn't work in cloud workers #3618

Closed Gozala closed 1 year ago

Gozala commented 3 years ago

Was trying to use client in cloud workers but it seems that some assumptions made about the runtime environment do not hold up.

Specifically I did see Cannot read property 'protocol' of undefined errors, unfortunately it's hard to pin down where they come from exactly as wrangler (cloudworker tool) compiles and minimized the whole thing before running it. This is a potential candidate (although I'm not sure, it looked more like from one of the dependencies)

https://github.com/ipfs/js-ipfs/blob/724562831f24d0a4f36b3ad42e5f44f2ddd470da/packages/ipfs-http-client/src/lib/core.js#L13-L15

Fixing that also exposed another problem with lack of AbortController, I have not had time to dig too much into this, but it seems that some runtime checks take it down the browser code path where native AbortController is assumed but that assumption fails.

I'll post more details if I'll get a chance to look into this more.

lidel commented 3 years ago

@Gozala is this related to the Nitro project work (higher priority), or more a maintenance task (best-effort)?

Gozala commented 3 years ago

@Gozala is this related to the Nitro project work (higher priority), or more a maintenance task (best-effort)?

We run into this limitation with nft.storage, however we just switched to using plain HTTP API so Nitro project isn't blocked by this. So I'd say mid priority probably.

tinytb commented 1 year ago

2022-11-22: there doesn't seem to be much demand for this. If the problem persists, feel free to open a new issue.