-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: TextDecoder is not a constructor
when handling multiaddresses in browser
#909
Comments
TypeError: TextDecoder is not a constructor
when handling multiaddresses in browser
Hello @da-kami |
Thanks for the quick reply! I subscribed to #904 but after a quick look on the dependencies, I am not sure #904 will resolve not depending on As far as I could see #904 updates https://github.com/multiformats/js-multiaddr/blob/v9.0.1/package.json#L41 |
As a temporary quickfix we use yarn's https://github.com/da-kami/js-libp2p-quote-poc/blob/master/package.json#L23-L26 |
|
Thanks! I gave |
Yes, facing an issue too when trying the release candidate:
|
The reported error is misleading as that await is wrapped by an async function: https://github.com/libp2p/js-libp2p/blob/master/src/upgrader.js#L257 I just tried our We are checking the RC with |
@vasco-santos great thanks! I actually quickly tried rc.3 yesterday and it looked good but I had to log off so did not have time to double check. Will report once I do more testing. |
Ok I can confirm the error is gone with |
I am now getting
Is that a known issue? |
Can you let me know your libp2p dependencies versions? Also do |
In the react app:
In the js-waku library that is used by the react app and brings in
|
This error comes from outdated multibase. You can already update everything in there except gossipsub (still needs ChainSafe/js-libp2p-gossipsub#153 merged) You can see on #912 what modules versions you should have. You can update everything except gossip, including new libp2p rc and you can experiment with gossipsub branch referenced for full functionality. Sorry for the delay, we are working on guaranteeing everything is working properly with |
Looks like gossipsub is released too. However, it seems that peer-id is still bringing an old multibase version:
No worries, thanks for the quick turn around! |
Wait, which multibase version is the outdated one?
|
I having the issue with multibase 4.0.4, the latest version. This is not expected, right?
|
everything in multibase should be 4+
The error now looks different then before. What node version are you using? You should be using 14 or 15 by now? A couple of other questions per latest dependency tree:
I think you need to reinstall the dependencies without your package lock, you have several versions that are not in the latest ones If you cannot solve this issue with the latest issues, please let me know if I can try to replicate this locally? |
Thanks. So there are still some multibase 3 coming from libp2p-noise for example:
The errors come from using
Indeed, it was an unused dependency, now removed. Thanks!
Indeed, now removed. |
Yes I have a |
This should be fixed with the new libp2p release and all the latest libp2p modules. Feel free to re-open if this is still a problem for you |
I am having the related issue again:
When running
And the parent project has latest multibase only:
and the multibase line that returns the error is indeed 4.0.4:
The code can be found at waku-org/js-waku#212 What am I missing? |
Is this still a problem? The PR was merged From an initial observation, the error seems different, probably using the latest https://github.com/multiformats/js-multibase/blob/master/src/util.js#L3 . So what environment is this running? |
It's running in |
0.30.12
87.0
Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
macOs Big Sur11.2.3
Type:
Bug
Severity:
Critical
Description:
When handling any kind of code that depends on https://github.com/multiformats/js-multibase the application crashes in the Browser with:
Test with Firefox and Chrome.
Using
require
for importing resulted in the same error.Using
multiaddr
function like shown in the chat example https://github.com/libp2p/js-libp2p/blob/master/examples/chat/src/dialer.js#L33 resulted in the same error.The problem seems to be related to how imports are handled in
multibase
.Steps to reproduce the error:
I ran into this problem when building a PoC trying to connect to a rust-libp2p daemon with js-libp2p from the browser:
https://github.com/da-kami/js-libp2p-quote-poc
Note: I also did a pure Javascript version which failed with the same error.
Are we missing something for working with Mutiaddress in the browser or is this a bug?
The text was updated successfully, but these errors were encountered: