ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

"process is not defined" error when using IPFS + React #4094

Closed AlexMesser closed 1 year ago

AlexMesser commented 2 years ago

Severity: High

Description:

I am using browser-create-react-app example. I just tried to add a custom swarm addresses to IPFS node:

ipfs = await create({
   config: {
   Addresses: {
      Swarm: [
          // This is a public webrtc-star server
         '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
         '/dns4/wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
      ],
   },
  }
})

And I got the error in console:

Uncaught ReferenceError: process is not defined
    at maybeReadMore (_stream_readable.js:561:1)
    at addChunk (_stream_readable.js:306:1)
    at readableAddChunk (_stream_readable.js:280:1)
    at Peer.Readable.push (_stream_readable.js:241:1)
    at Peer._onChannelMessage (index.js:915:1)
    at RTCDataChannel._channel.onmessage (index.js:465:1)

Screen Shot 2022-05-12 at 18 10 46

Also, when I am trying to establish direct swarm connection I am getting the similar error:

await ipfs.swarm.connect(<multiaddr>)

error:

index.js:31 Uncaught (in promise) AggregateError: 
    ReferenceError: process is not defined
        at Peer.Readable.on (http://localhost:3000/static/js/bundle.js:148762:9)
        at createReadableStreamAsyncIterator (http://localhost:3000/static/js/bundle.js:150206:10)
        at Peer.Readable.<computed> (http://localhost:3000/static/js/bundle.js:148950:12)
        at getIterator (http://localhost:3000/static/js/bundle.js:22639:39)
        at toMultiAbortableSource (http://localhost:3000/static/js/bundle.js:10586:12)
        at toAbortableSource (http://localhost:3000/static/js/bundle.js:10580:56)
        at module.exports (http://localhost:3000/static/js/bundle.js:63070:30)
        at ClassIsWrapper.dial (http://localhost:3000/static/js/bundle.js:62590:20)
        at async TransportManager.dial (http://localhost:3000/static/js/bundle.js:76443:14)
        at async http://localhost:3000/static/js/bundle.js:67552:18
    ReferenceError: process is not defined
        at Peer.Readable.on (http://localhost:3000/static/js/bundle.js:148762:9)
        at createReadableStreamAsyncIterator (http://localhost:3000/static/js/bundle.js:150206:10)
        at Peer.Readable.<computed> (http://localhost:3000/static/js/bundle.js:148950:12)
        at getIterator (http://localhost:3000/static/js/bundle.js:22639:39)
        at toMultiAbortableSource (http://localhost:3000/static/js/bundle.js:10586:12)
        at toAbortableSource (http://localhost:3000/static/js/bundle.js:10580:56)
        at module.exports (http://localhost:3000/static/js/bundle.js:63070:30)
        at ClassIsWrapper.dial (http://localhost:3000/static/js/bundle.js:62590:20)
        at async TransportManager.dial (http://localhost:3000/static/js/bundle.js:76443:14)
        at async http://localhost:3000/static/js/bundle.js:67552:18
    at maybeSettle (http://localhost:3000/static/js/bundle.js:105393:14)
    at http://localhost:3000/static/js/bundle.js:105431:27
welcome[bot] commented 2 years ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

BigLep commented 2 years ago

2022-05-27 conversation: we need to review the https://github.com/ipfs-examples/js-ipfs-examples/tree/master/examples/browser-create-react-app example to see if there any updates we need to make.

AlexMesser commented 2 years ago

UPD: can't reproduce it on version 0.15.2

achingbrain commented 1 year ago

This sounds like it's been resolved so I am going to close this issue.