decentralized-identity / decentralized-identity/web5-js

Web5.connect exits early when running project with node runtime

Open
#392 1 comment 0 reactions 0 assignees View on GitHub
package: api
Dominant language
TypeScript
Stars
142
Forks
56
PR merge metrics
No merged PRs in 30d

Description

I've been following the [Quickstart Guide](https://developer.tbd.website/docs/web5/quickstart) 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:

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

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

console.log(aliceDid);
}

main();
```

```json5
// 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.