hyper-sdk icon indicating copy to clipboard operation
hyper-sdk copied to clipboard

TypeError: hyperswarm is not a function

Open r-token opened this issue 3 years ago • 2 comments

When using the hyper-sdk via npm and requiring it in a file, I get an error that says Uncaught (in promise) TypeError: hyperswarm is not a function. This error doesn't occur when I build the bundle for browsers myself and include the hyper-sdk-bundle.js file in the project manually - but going this route won't work well for our setup.

The full error is below: hyperswarm-not-a-function

It looks like the 'not a function' part it's referring to is from here: hyperswarm-invalid

And that hyperswarm comes from the hyperswarm-web package: Screen Shot 2021-08-05 at 3 30 13 PM

Let me know if you need any additional information or if you'd prefer me to log this issue in the hyperswarm-web repo.

r-token avatar Aug 06 '21 21:08 r-token

Just to confirm, are you trying to use hyper-sdk inside a webapp?

What are you using to make require work in the browser? There have been a bunch of issues with webpack, and I think building the bundle is the only surefire way to get stuff working.

RangerMauve avatar Aug 30 '21 22:08 RangerMauve

Whoops, missed your reply. Apologies! To answer your questions:

  1. Yes we were trying to use hyper-sdk within a web app
  2. We're using Browserify or Parcel for this (not webpack)

Also, building the bundle did indeed get past this issue - using a bundler just fits in nicer with our current workflow.

r-token avatar Sep 23 '21 16:09 r-token

New version of hyper-sdk should change this. Please reopen if you're still facing this error.

RangerMauve avatar Feb 01 '23 17:02 RangerMauve