Skip to content
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

bug: @libp2p/bootstrap and @libp2p/interface peer dependencies not correctly added #2199

Closed
nicobao opened this issue Jan 6, 2025 · 5 comments · Fixed by #2200
Closed

bug: @libp2p/bootstrap and @libp2p/interface peer dependencies not correctly added #2199

nicobao opened this issue Jan 6, 2025 · 5 comments · Fixed by #2200
Assignees

Comments

@nicobao
Copy link

nicobao commented Jan 6, 2025

Hey there!

I get this error with @waku/sdk v0.0.29 when running pnpm dev (obviously done after having pnpm install successfully):

node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@libp2p/bootstrap' imported from /home/nicobao/zkorum/agora/services/api/node_modules/.pnpm/@waku+sdk@0.0.29_@libp2p+interface@1.7.0_@multiformats+multiaddr@12.3.4/node_modules/@waku/sdk/dist/create/libp2p.js

After I try pnpm add @libp2p/bootstrap and run the app, I get the following error:

node_modules/.pnpm/@waku+core@0.0.33_@multiformats+multiaddr@12.3.4_libp2p@1.9.4/node_modules/@waku/core/src/lib/connection_manager.ts:2
import { CustomEvent, TypedEventEmitter } from "@libp2p/interface";
         ^

SyntaxError: The requested module '@libp2p/interface' does not provide an export named 'CustomEvent'

So I try pnpm add @libp2p/interface and I get the following error:

± |main {3} U:7 ?:1 ✗| → pnpm add @libp2p/interface
 WARN  3 deprecated subdependencies found: @esbuild-kit/core-utils@3.3.2, @esbuild-kit/esm-loader@2.6.5, @libp2p/mplex@10.1.5
Already up to date
Progress: resolved 923, reused 879, downloaded 0, added 0, done
 WARN  Issues with peer dependencies found
.
└─┬ @waku/sdk 0.0.29
  ├── ✕ unmet peer @libp2p/bootstrap@^10: found 11.0.16
  └─┬ @waku/discovery 0.0.6
    └── ✕ unmet peer @libp2p/interface@^1.6.3: found 2.3.0

Minimal Repro with my setup (ESM, pnpm, TypeScript, backend Fastify): https://github.com/nicobao/waku-repro

@chair28980 chair28980 added this to Waku Jan 6, 2025
@nicobao
Copy link
Author

nicobao commented Jan 6, 2025

Btw, this happened in the past with other people already, see:

But the solution if exists is un-documented.

Possible cause of the bug - credits to https://discordapp.com/channels/1110799176264056863/1111533561489653790/1180252103927681176 :
"I tried to understand the possible cause. The libp2p structure might have been updated.
.Path -> \node_modules\@waku\dns-discovery\src\dns_discovery.ts
The EventEmitter is no longer found under the@libp2p/interface/events"
Image

@weboko weboko self-assigned this Jan 7, 2025
@weboko weboko moved this from Triage to Priority in Waku Jan 7, 2025
@weboko weboko moved this from Priority to In Progress in Waku Jan 7, 2025
@weboko
Copy link
Collaborator

weboko commented Jan 10, 2025

@nicobao could you, please, try with @waku/sdk@0.0.30-1c0c5ee.0?
I was able to repro your problem and it is resolved with mentioned version. Can you confirm, please?

PR #2200

@weboko weboko moved this from In Progress to Code Review / QA in Waku Jan 10, 2025
@nicobao
Copy link
Author

nicobao commented Jan 11, 2025

Amazing, thanks for your prompt reactivity. I'm looking at this asap.

@weboko
Copy link
Collaborator

weboko commented Jan 14, 2025

Closing as it seems to be working fine :)

@weboko weboko closed this as completed Jan 14, 2025
@github-project-automation github-project-automation bot moved this from Code Review / QA to Done in Waku Jan 14, 2025
@nicobao
Copy link
Author

nicobao commented Jan 17, 2025

Sorry for the delay. I finally had time to test. It works fine! 🙏

Just a question, upon writing await wakuNode.waitForPeers([Protocols.LightPush]);, I get:

Ignore WebSocket connection failures
Waku tries to discover peers and some of them are expected to fail

and it blocks the entire execution, as it seems it's not finding any peers... What is the recommended way to run this asynchronously?

Code called that blocks execution:

// Create and start a Light Node
const wakuNode = await createLightNode({
    defaultBootstrap: true,
    networkConfig: {
        clusterId: 1,
        contentTopics: ["/myapp/1/my-topic/proto"],
    },
});
await wakuNode.start();
await wakuNode.waitForPeers([Protocols.LightPush]);

Is it not finding peers because no existing node support "/myapp/1/my-topic/proto" as a content topic? Am I expected to run a node myself for my specific application? Or are existing generic nodes accepting any content topics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants