bug: new kubo/ipfs/libp2p protocols break JS ecosystem
SgtPooki opened this issue · 2 comments
Describe the bug
Multiple issues across the JS ecosystem when new protocols are added.
js-multiaddr/src/protocols-table.ts
Lines 4 to 55 in 6cfb7ad
To Reproduce
Steps to reproduce the behavior:
- pull down repo ipfs/ipfs-webui
git checkout ea89e7f
rm patches/multiaddr+8.1.2.patch
npm install
- start
ipfs daemon
using kubo 0.18.1 or later in another terminal- Note the port number in the line
API server listening on /ip4/127.0.0.1/tcp/<kuboPort>
- Note the port number in the line
- run
KUBO_PORT_2033_TEST=<kuboPort> npm run test:unit -- src/bundles/identity.test.js
- Note the error "no protocol with name: quic-v1"
Expected behavior
Looking up unknown protocols does not propagate errors, nor cause requests to fail. We should fallback to supported/known protocols
Additional context
Potential Solutions
- Pull out protocols-table.js into it's own package. Keep it at
v1.0.x
, there are NO breaking changes, only protocols added. Any JS package stays up to date by depending directly on the table - Stop throwing errors from
js-multiaddr/src/protocols-table.ts
Lines 79 to 95 in 6cfb7ad
- backport any protocol-table changes for all multiaddr versions (No one wants to do this)
Is this problem showing up in packages using an older version of js-multiaddr
? If so, what's stopping an upgrade to the latest version of js-multiaddr
?
Is this problem showing up in packages using an older version of
js-multiaddr
? If so, what's stopping an upgrade to the latest version ofjs-multiaddr
?
I’ll have to investigate this to confirm. Maybe this problem is solved in the latest versions.
However, I imagine it would still be a problem if anyone is out of date on any package required, which can be really confusing.
This issue was intended to bring attention to this error and that the only viable solutions are:
- Update all packages
- Patch your old version of the package
- Ensure all packages in the lib-space (the ones we own) guard against new and unexpected failures.
However, all of those mean someone(consumers, consumers, owners; respectively) is responsible for work that we shouldn't require of them.
Number 1 is improbable to expect all consumers to be able to do.
Number 2 is a localized fix for a global problem.
Number 3 is a not-DRY and highly error-prone solution thats not practical nor maintainable.
Ideally, we could solve this problem in a future proof way where
- newly added protocols don’t need guarded against in every lib consuming this one
- Consumers with old deps arent forced between a rock and a hard place
- Devs don’t need to solve this error everytime we utilize this package.
I’m not 100% sure what the fix for this should be right now but I know we need to a better solution. My gut instinct for a solution is converting the fatal error to a logged but passable one.