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

Package subpath './peer-job-queue' is not defined by "exports" for circuit-relay #2243

Closed
benzmuircroft opened this issue Nov 19, 2023 · 4 comments
Labels
kind/stale need/author-input Needs input from the original author

Comments

@benzmuircroft
Copy link

benzmuircroft commented Nov 19, 2023

I'm in the dark here, you could use some work on your git docs!

I found defaults https://github.com/ipfs/helia/blob/main/packages/helia/src/utils/libp2p-defaults.ts for libp2p cause I could not find it here.

used https://www.npmjs.com/package/@libp2p/circuit-relay-v2 because 'libp2p/circuit-relay' doesn't exist

got this error

(node:1675237) UnhandledPromiseRejectionWarning: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './peer-job-queue' is not defined by "exports" in /home/benz/Desktop/vite/app/node_modules/@libp2p/utils/package.json imported from /home/benz/Desktop/vite/app/node_modules/@libp2p/circuit-relay-v2/dist/src/transport/reservation-store.js
    at new NodeError (node:internal/errors:399:5)
    at exportsNotFound (node:internal/modules/esm/resolve:361:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:697:9)
    at packageResolve (node:internal/modules/esm/resolve:878:14)
    at moduleResolve (node:internal/modules/esm/resolve:944:20)
    at defaultResolve (node:internal/modules/esm/resolve:1159:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
(Use `electron --trace-warnings ...` to show where the warning was created)
(node:1675237) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

The npm package put this main repo as where to report bugs, and they look like part of your team, so if you get mad at me for posting this here go ask why they did that in the first place.

  • Version:
    the latest

  • Platform:
    inux benz-iMac 5.15.0-88-generic 98-Ubuntu SMP Mon Oct 2 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

  • Subsystem:
    libp2p

Severity:

boom

Description:

loaded libp2p

Steps to reproduce the error:

// this should be deleted after it is called
  //const { MemoryDatastore } = await import('datastore-core')
  //const { MemoryBlockstore } = await import('blockstore-core')
  const { circuitRelayTransport, circuitRelayServer } = await import('@libp2p/circuit-relay-v2')
  const { tcp } = await import('@libp2p/tcp')
  const { webRTC, webRTCDirect } = await import('@libp2p/webrtc')
  const { webSockets } = await import('@libp2p/websockets')
  const { mdns } = await import('@libp2p/mdns')
  const { noise } = await import('@chainsafe/libp2p-noise')
  const { yamux } = await import('@chainsafe/libp2p-yamux')
  const { identify } = await import('@libp2p/identify')
  const { autoNAT } = await import('@libp2p/autonat')
  const { uPnPNAT } = await import('@libp2p/upnp-nat')
  const { dcutr } = await import('@libp2p/dcutr')
  const { kadDHT } = await import('@libp2p/kad-dht')
  const { ping } = await import('@libp2p/ping')
  const { gossipsub } = await import('@chainsafe/libp2p-gossipsub') // https://github.com/ChainSafe/js-libp2p-gossipsub
  const IPFS = await import('ipfs-core')
  //const { createOrbitDB, IPFSAccessController } = await import('@orbitdb/core')
  const { createLibp2p } = await import('libp2p')
  const Room = require('ipfs-pubsub-room')

  //const datastore = new MemoryDatastore()
  //const blockstore = new MemoryBlockstore()

  const libp2p = await createLibp2p({
    //datastore,
    addresses: {
      listen: ['/ip4/0.0.0.0/tcp/0', '/ip6/::/tcp/0', '/webrtc'],
      swarm: ['/ip4/127.0.0.1/tcp/9090/ws']
    },
    transports: [
      circuitRelayTransport({
        discoverRelays: 1
      }),
      tcp(),
      webRTC(),
      webRTCDirect(),
      webSockets()
    ],
    peerDiscovery: [mdns()],
    connectionEncryption: [noise()],
    streamMuxers: [yamux()],
    services: {
      identify: identify(),
      autoNAT: autoNAT(),
      upnpNAT: uPnPNAT(),
      dcutr: dcutr(),
      circuitRelay: circuitRelayServer({
        advertise: true
      }),
      dht: kadDHT(),
      ping: ping(),
      pubsub: gossipsub()
    }
  })
@benzmuircroft benzmuircroft added the need/triage Needs initial labeling and prioritization label Nov 19, 2023
@maschad
Copy link
Member

maschad commented Nov 20, 2023

Sorry about this 😓 this will be fixed once @libp2p/circuit-relay-v2 v5.0.0 is released. We have some breaking changes which included moving circuit-relay to it's own module and these packages will be published soon.

Our docs do need to be updated, we have a issues related to that under good first issues if you're interested 😉

We also do have an issue to create some libp2p defaults as well

@maschad
Copy link
Member

maschad commented Nov 21, 2023

used npmjs.com/package/@libp2p/circuit-relay-v2 because 'libp2p/circuit-relay' doesn't exist

It should exist within v0.46.21 of libp2p, could you try the following code snippet?

  const { circuitRelayTransport, circuitRelayServer } = await import('libp2p/circuit-relay')
  const { tcp } = await import('@libp2p/tcp')
  const { webRTC, webRTCDirect } = await import('@libp2p/webrtc')
  const { webSockets } = await import('@libp2p/websockets')
  const { mdns } = await import('@libp2p/mdns')
  const { noise } = await import('@chainsafe/libp2p-noise')
  const { yamux } = await import('@chainsafe/libp2p-yamux')
  const { identifyService } = await import('libp2p/identify')
  const { autoNATService } = await import('libp2p/autonat')
  const { uPnPNATService } = await import('libp2p/upnp-nat')
  const { dcutrService } = await import('libp2p/dcutr')
  const { kadDHT } = await import('@libp2p/kad-dht')
  const { pingService } = await import('libp2p/ping')
  const { gossipsub } = await import('@chainsafe/libp2p-gossipsub') // https://github.com/ChainSafe/js-libp2p-gossipsub
  const IPFS = await import('ipfs-core')
  //const { createOrbitDB, IPFSAccessController } = await import('@orbitdb/core')
  const { createLibp2p } = await import('libp2p')

  //const datastore = new MemoryDatastore()
  //const blockstore = new MemoryBlockstore()

  const libp2p = await createLibp2p({
    //datastore,
    addresses: {
      listen: ['/ip4/0.0.0.0/tcp/0', '/ip6/::/tcp/0', '/webrtc'],
      swarm: ['/ip4/127.0.0.1/tcp/9090/ws']
    },
    transports: [
      circuitRelayTransport({
        discoverRelays: 1
      }),
      tcp(),
      webRTC(),
      webRTCDirect(),
      webSockets()
    ],
    peerDiscovery: [mdns()],
    connectionEncryption: [noise()],
    streamMuxers: [yamux()],
    services: {
      identify: identifyService(),
      autoNAT: autoNATService(),
      upnpNAT: uPnPNATService(),
      dcutr: dcutrService(),
      circuitRelay: circuitRelayServer({
        advertise: true
      }),
      dht: kadDHT(),
      ping: pingService(),
      pubsub: gossipsub()
    }
  })

@maschad maschad added need/author-input Needs input from the original author and removed need/triage Needs initial labeling and prioritization labels Nov 21, 2023
Copy link
Contributor

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

Copy link
Contributor

github-actions bot commented Dec 5, 2023

This issue was closed because it is missing author input.

@github-actions github-actions bot closed this as completed Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/stale need/author-input Needs input from the original author
Projects
None yet
Development

No branches or pull requests

2 participants