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

Web5.connect exits early when running project with node runtime #392

Open
pmuens opened this issue Jan 31, 2024 · 1 comment
Open

Web5.connect exits early when running project with node runtime #392

pmuens opened this issue Jan 31, 2024 · 1 comment
Labels
package: api @web5/api pacakge

Comments

@pmuens
Copy link

pmuens commented Jan 31, 2024

I've been following the Quickstart Guide on the TBD developer website and am running into an issue during step "1. Instantiate Web5 and Create DID" where I try to console.log the DID I just created.

Rather than logging the DID, the node runtime exists early. If I use bun on the other hand, everything is working fine and I can see my DID on the terminal. The interesting part is that once I ran bun index.js I can switch back to node index.js to see the same result I saw after running bun index.js.

Not sure if this could be a race condition or has something to do with node itself.

I'm running @web5/api version 0.8.4. My Node.js version is 20.5.1 and my Bun version is 2.0.14.

Here are the files I created:

// index.js
import { Web5 } from "@web5/api";

async function main() {
  const { web5, did: aliceDid } = await Web5.connect();

  console.log(aliceDid);
}

main();
// package.json
{
  "name": "web5-app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@web5/api": "^0.8.4"
  },
  "type": "module"
}

Running node index.js returns early without logging anything. Running bun index.js logs the DID.

@ianpatton
Copy link

FWIW: I can reproduce this on node 20.4.0, 20.5.0, 20.5.1, but not on 20.3.0 or before, or 20.6.0 or after. I recommend using the latest LTM release 20.11

@frankhinek frankhinek added the package: api @web5/api pacakge label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: api @web5/api pacakge
Projects
None yet
Development

No branches or pull requests

3 participants