Skip to content

[Bug] WASM example 1_advanced/4_custom_resolution.ts not compatible with NodeJs 22 #1525

@wulfraem

Description

@wulfraem

Bug description

WASM example 1_advanced/4_custom_resolution.ts not compatible with NodeJs 22, but works fine with NodeJs 20.

Language version

  • Rust rustc 1.84.0 (9fc6b4312 2025-01-07)
  • NodeJs 22 and 20 (see below)

IOTA Identity version

  • v1.5.0 / current main branch

Steps To reproduce the bug

  1. Use Node 22
  2. Run the example, e.g. with npm run build:nodejs && npm run example:node -- 4_custom_resolution
  3. Should run into an error

Trying the same with Node 20 works just fine.

Expected behaviour

Example should be starting.

Actual behaviour

We're getting an error, as long as the import is used, e.g. with:

// (other imports)

import * as ed25519 from "@transmute/did-key-ed25519";

export async function customResolution() {
    // Set up a handler for resolving Ed25519 did:key
    const keyHandler = async function(didKey: string): Promise<CoreDocument> {
        const foobar = ed25519;
        return null as any;
    };

    // rest can be omitted
}

Errors

> ts-node --project tsconfig.node.json -r tsconfig-paths/register ./examples/src/main.ts 4_custom_resolution


  #  node[88297]: void node::fs::InternalModuleStat(const FunctionCallbackInfo<v8::Value> &) at ../src/node_file.cc:1039
  #  Assertion failed: (args.Length()) >= (2)

----- Native stack trace -----

 1: 0x100ddcd1c node::Assert(node::AssertionInfo const&) [/Users/example/.local/share/nvm/v22.13.0/bin/node]
 2: 0x102a0a3a4 node::fs::InternalModuleStat(v8::FunctionCallbackInfo<v8::Value> const&) (.cold.3) [/Users/example/.local/share/nvm/v22.13.0/bin/node]
 3: 0x100df0c94 node::fs::InternalModuleStat(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/example/.local/share/nvm/v22.13.0/bin/node]
 4: 0x1019baf98 Builtins_CallApiCallbackGeneric [/Users/example/.local/share/nvm/v22.13.0/bin/node]
 5: 0x1019b8ef0 Builtins_InterpreterEntryTrampoline [/Users/example/.local/share/nvm/v22.13.0/bin/node]
 6: 0x1019b8ef0 Builtins_InterpreterEntryTrampoline [/Users/example/.local/share/nvm/v22.13.0/bin/node]
 7: 0x1019b8ef0 Builtins_InterpreterEntryTrampoline [/Users/example/.local/share/nvm/v22.13.0/bin/node]
 8: 0x1019b8ef0 Builtins_InterpreterEntryTrampoline [/Users/example/.local/share/nvm/v22.13.0/bin/node]
 9: 0x1019b8ef0 Builtins_InterpreterEntryTrampoline [/Users/example/.local/share/nvm/v22.13.0/bin/node]

(...)

----- JavaScript stack trace -----

1: /Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:34535
2: /Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:34176
3: /Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:34506
4: /Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:173374
5: /Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:173420
6: /Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:173521
7: /Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:258942
8: /Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:261569
9: e (/Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:262673)
10: get (/Users/example/projects/iota/identity.rs-wasm-1/bindings/wasm/identity_wasm/node_modules/esm/esm.js:1:262740)

Metadata

Metadata

Assignees

Labels

BugSomething isn't working.WasmRelated to Wasm bindings. Becomes part of the Wasm changelog

Type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions