rust-libp2p icon indicating copy to clipboard operation
rust-libp2p copied to clipboard

gossipsub: Uncaught TypeError when running in the browser

Open dariusc93 opened this issue 1 year ago • 0 comments

Summary

When running an application using libp2p-gossipsub targeting wasm32 in the browser, it seems an error Uncaught TypeError: The specifier “env” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”. is produced. After inspection, it points to futures-ticker, which still depends on instant. Previously this was not a problem because we used to have the feature enabled up until https://github.com/libp2p/rust-libp2p/pull/5347 was merged.

Keep in mind, this is just by it being included. It does not have to run the code itself.

Expected behavior

For the application to run in the browser

Actual behavior

Gives an error in console

Relevant log output

No response

Possible Solution

  1. Add instant = { version = "0.1.13", features = ["wasm-bindgen"] } to libp2p-gossipsub when targeting wasm32; or
  2. Submit PR to futures-ticker to enable this feature for wasm32 target (or replace it with web-time); or
  3. Replace futures-ticker with in-house code that performs similar or the same behaviour.

Version

0.54.1 and master

Would you like to work on fixing this bug ?

Maybe

dariusc93 avatar Oct 04 '24 03:10 dariusc93