JS-IPFS/Browserify on Web Server

Although the Browserify Example works like a charm when the files are stored locally, it has issues when index.html and bundle.js are fetched from a remote web server.

  • Chrome/Opera give this error:

bundle.js:101706 Uncaught TypeError: Cannot read property ‘generateKey’ of undefined
at Object.exports.generateKey (bundle.js:101706)
at Object.generateKeyPair (bundle.js:102005)
at Object.exports.generateKeyPair (bundle.js:101466)
at waterfall (bundle.js:191459)
at nextTask (bundle.js:36585)
at exports.default (bundle.js:36595)
at Function.exports.create (bundle.js:191458)
at waterfall (bundle.js:73857)
at nextTask (bundle.js:36585)
at next (bundle.js:36592)
bundle.js:35238 Uncaught Error: Callback was already called.
at bundle.js:35238
at db.get (bundle.js:52194)
at bundle.js:100766
at bundle.js:54326
at IDBTransaction.tx.onabort (bundle.js:99698)

  • Firefox works!
  • Edge fails silently.
  • On Android, Chrome/Firefox/Opera are not working either.

Is there a tweak i am missing?

maybe this thread can be help : https://github.com/ipfs/js-ipfs/issues/964 for chrome.

that’s caused by browser certain are not implemented webCrypto et for that you need to use a polyfill and third party library.

Regards

Yay, so it requires https, thanks @josselinchevalay!