hotg-ai / rune

Rune provides containers to encapsulate and deploy edgeML pipelines and applications
Apache License 2.0
134 stars 15 forks source link

Make the web runtime usable from NodeJS #270

Open Michael-F-Bryan opened 3 years ago

Michael-F-Bryan commented 3 years ago

We currently can't use the web bindings out of the browser because the tfjs-tflite package uses browser-specific APIs (e.g. self and Blob).

It'd be really nice if we could run unit tests for our web bindings in CI without needing to start up a browser.

Michael-F-Bryan commented 3 years ago

Steps to reproduce:

$ cd bindings/web/
$ yarn test
  yarn run v1.22.5
  $ jest
   PASS  dist/Shape.test.js
      Finished dev [unoptimized + debuginfo] target(s) in 0.36s
       Running `target/debug/rune build /home/michael/Documents/hotg-ai/rune/examples/noop/Runefile.yml --quiet`
  node:internal/process/promises:246
            triggerUncaughtException(err, true /* fromPromise */);
            ^

  [UnhandledPromiseRejection: 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(). 
  The promise rejected with the reason "ReferenceError: self is not defined".] {
    code: 'ERR_UNHANDLED_REJECTION'
  }

Note the "ReferenceError: self is not defined" bit.

Michael-F-Bryan commented 3 years ago

I've created a ticket for this upstream: https://github.com/tensorflow/tfjs/issues/5532.