hyperledger-archives / aries-framework-go

Hyperledger Aries Framework Go provides packages for building Agent / DIDComm services.
https://wiki.hyperledger.org/display/ARIES/aries-framework-go
Apache License 2.0
240 stars 161 forks source link

aries-js-worker: broken for Node.js #1237

Open llorllale opened 4 years ago

llorllale commented 4 years ago

Some parts of the WASM always assume it's running in the browser. For example, the jsindexeddb package is being loaded and this call fails (there is no object named indexedDB in Node).

To reproduce:

npm install @hyperledger/aries-framework-go@0.1.2-snapshot-2f18056
const { Aries } = require("@hyperledger/aries-framework-go")

setTimeout(() => {
    Aries._test._echo("test").then(
        response => console.log(response),
        err => console.error(err)
    )
}, 1000)
Error

$ node App.js panic: syscall/js: call of Value.Call on undefined goroutine 7 [running]: syscall/js.Value.Call(0x0, 0x11705a, 0x4, 0x85ab90, 0x2, 0x2, 0xe) /opt/hostedtoolcache/go/1.13.7/x64/src/syscall/js/js.go:318 +0x7f github.com/hyperledger/aries-framework-go/pkg/storage/jsindexeddb.openDB(0x1183e6, 0x8, 0x3a972, 0x100cc40, 0xfd508) /home/runner/work/aries-framework-go/aries-framework-go/pkg/storage/jsindexeddb/jsindexeddb.go:49 +0x6 github.com/hyperledger/aries-framework-go/pkg/storage/jsindexeddb.(*Provider).OpenStore(0x76ece0, 0x1183e6, 0x8, 0x100cc28, 0x773a01, 0x98c640, 0x100cc28) /home/runner/work/aries-framework-go/aries-framework-go/pkg/storage/jsindexeddb/jsindexeddb.go:39 +0x2 github.com/hyperledger/aries-framework-go/pkg/kms/legacykms.New(0x100cc28, 0x98c640, 0x98c640, 0x100cc28, 0x98c640) /home/runner/work/aries-framework-go/aries-framework-go/pkg/kms/legacykms/kms.go:40 +0x7 github.com/hyperledger/aries-framework-go/pkg/framework/aries.setAdditionalDefaultOpts.func1(0x1c3240, 0x98c640, 0x1, 0x98c640, 0x0, 0x0) /home/runner/work/aries-framework-go/aries-framework-go/pkg/framework/aries/default.go:77 +0x3 github.com/hyperledger/aries-framework-go/pkg/framework/aries.createKMS(0x801080, 0x24, 0x8284b0) /home/runner/work/aries-framework-go/aries-framework-go/pkg/framework/aries/framework.go:330 +0xe github.com/hyperledger/aries-framework-go/pkg/framework/aries.initializeServices(0x801080, 0x0, 0x0, 0x24) /home/runner/work/aries-framework-go/aries-framework-go/pkg/framework/aries/framework.go:104 +0x2 github.com/hyperledger/aries-framework-go/pkg/framework/aries.New(0x83ae80, 0x1, 0x1, 0xd2940, 0xc28d760608237e01, 0x853e10) /home/runner/work/aries-framework-go/aries-framework-go/pkg/framework/aries/framework.go:98 +0x22 main.getAllCommands(0x9987e0, 0x0, 0x0) /home/runner/work/aries-framework-go/aries-framework-go/cmd/aries-js-worker/main.go:92 +0x7 main.handlers(0x0) /home/runner/work/aries-framework-go/aries-framework-go/cmd/aries-js-worker/main.go:53 +0x4 main.pipe(0x82a3c0, 0x82a420) /home/runner/work/aries-framework-go/aries-framework-go/cmd/aries-js-worker/main.go:138 +0x2 created by main.main /home/runner/work/aries-framework-go/aries-framework-go/cmd/aries-js-worker/main.go:74 +0x4 /home/llorllale/dev/node/test/App.js:4 Aries._test._echo("test").then( ^ TypeError: Cannot read property '_echo' of undefined at Timeout._onTimeout (/home/llorllale/dev/node/test/App.js:4:17) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7)

jceb commented 3 years ago

What's the status of this bug? Would be great to get aries-go working in Node!

vongohren commented 3 years ago

It was added to 0.1.5 mileston which was completed back in the days and is it in any lists now? So it might be investigated?