Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chereseeriepa opened this issue May 21, 2024 · 1 comment
Open

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

chereseeriepa opened this issue May 21, 2024 · 1 comment

Comments

@chereseeriepa
Copy link

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:

  • I am taking a look into this repo as I am doing some work with Ben Tairea and Mix Irving around holder connections.
  • Since the README mentions the demos, I thought that was a good place to start, but hit a bump when the demos wouldn't work.

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

> [email protected] 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
Copy link
Contributor

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:

  • Demos as such in nodejs will disappear.
  • In replacement for those we will create a binary command in the npm package.
  • Any user will be able to install the npm package and run commands like:

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants