hyperledger / identus-edge-agent-sdk-ts

Apache License 2.0
15 stars 8 forks source link

The NodeJs CommonJS and ESM demos are throwing an error #223

Open chereseeriepa opened 1 month ago

chereseeriepa commented 1 month ago

Is this a regression?

Yes

Description

When trying to start up the two NodeJs demos, they are throwing an error.

I made sure they were built correctly from the main branch, using the right Node version (an other requirements listed in the README).

Context as to why I am here:

Please provide the exception or error you saw

~/atala-prism-wallet-sdk-ts/demos/node-cjs main !2 > npm run start                                                                                                                                7s node 20.13.1

> test-with-sdk@1.0.0 start
> node src/index.js

/atala-prism-wallet-sdk-ts/build/node/index.cjs:10898
        const mediationHandler = await this.mediationHandler.bootRegisteredMediator();
                                                             ^

TypeError: Cannot read properties of undefined (reading 'bootRegisteredMediator')
    at ConnectionsManager.startMediator (/atala-prism-wallet-sdk-ts/build/node/index.cjs:10898:62)
    at Agent.start (/atala-prism-wallet-sdk-ts/build/node/index.cjs:11869:42)
    at async /atala-prism-wallet-sdk-ts/demos/node-cjs/src/index.js:58:3

Please provide the environment you discovered this bug in

Local development environment on MacOS.

Node v20.13.1

Anything else?

I did some looking into this, and saw that both demos are incorrectly passing in the mediationHandler:

const manager = new SDK.ConnectionsManager(castor, mercury, pluto, handler);

Should be

const manager = new SDK.ConnectionsManager(castor, mercury, pluto, ..., handler);

according to the ConnectionsManager constructor in the build.

Files:

elribonazo commented 1 month ago

I would even go further into this.

The demos in nodejs are getting outdates there's no discussion here, but on the other hand... the nodejs demos have never really shown a full application and where just reference implementations.

My ideal proposal or future for the SDK would be the following:

StartAndListen ./sdkBinary start --arguments ....

@mixmix, @chereseeriepa whats your point of view on this previous¿?