js-ipfs icon indicating copy to clipboard operation
js-ipfs copied to clipboard

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

Open AlexMesser opened this issue 3 years ago • 3 comments

  • Version: 0.14.3
  • Platform: macOS Monterey, Google Chrome 101.0.4951.54
  • Subsystem:

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

AlexMesser avatar May 12 '22 14:05 AlexMesser

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:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

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

welcome[bot] avatar May 12 '22 14:05 welcome[bot]

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.

BigLep avatar May 27 '22 14:05 BigLep

UPD: can't reproduce it on version 0.15.2

AlexMesser avatar Jul 21 '22 16:07 AlexMesser

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

achingbrain avatar May 22 '23 14:05 achingbrain