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

Headers is not defined for target=nodejs #8

Closed
eigmax opened this issue Aug 18, 2022 · 1 comment
Closed

Headers is not defined for target=nodejs #8

eigmax opened this issue Aug 18, 2022 · 1 comment

Comments

@eigmax
Copy link
Member

eigmax commented Aug 18, 2022

index.js:

const { gg18 } = require("@ieigen/tss-wasm-node");

async function main() {
  const t = 1;
    const n = 3;
    context = await gg18.gg18_keygen_client_new_context(
      "http://127.0.0.1:8000",
      t,
      n
    );
    console.log("keygen new context: ", context);
    context = await gg18.gg18_keygen_client_round1(context);
    console.log("keygen round1: ", context);
    context = await gg18.gg18_keygen_client_round2(context);
    console.log("keygen round2: ", context);
    context = await gg18.gg18_keygen_client_round3(context);
    console.log("keygen round3: ", context);
    context = await gg18.gg18_keygen_client_round4(context);
    console.log("keygen round4: ", context);
    const keygen_json = await gg18.gg18_keygen_client_round5(context);
    console.log("keygen json: ", keygen_json);
    res.json(util.Succ(keygen_json));
}

main().then(() => {
  console.log("done")
})

run: node index.js
error:

post resp Err(reqwest::Error { kind: Builder, source: "JsValue(ReferenceError: Headers is not defined\nReferenceError: Headers is not defined\n    at /Users/Project/dev/tss-wasm/pkg/tss_wasm.js:549:17\n    at handleError (/Users/Project/dev/tss-wasm/pkg/tss_wasm.js:438:18)\n    at module.exports.__wbg_new_4cba26249c1686cd (/Users/Project/dev/tss-wasm/pkg/tss_wasm.js:548:65)\n    at wasm://wasm/008f18ba:wasm-function[1139]:0xf66ee\n    at wasm://wasm/008f18ba:wasm-function[100]:0x5c0d0\n    at wasm://wasm/008f18ba:wasm-function[177]:0x8e261\n    at wasm://wasm/008f18ba:wasm-function[276]:0xae7df\n    at wasm://wasm/008f18ba:wasm-function[822]:0xebae7\n    at wasm://wasm/008f18ba:wasm-function[601]:0xdbb8a\n    at wasm://wasm/008f18ba:wasm-function[1258]:0xf7cef)" })
@eigmax
Copy link
Member Author

eigmax commented Aug 18, 2022

Upgrade node to 18.0 to support fetch API. https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API @Weber-H2O2

eigmax added a commit that referenced this issue Aug 19, 2022
@eigmax eigmax closed this as completed Aug 19, 2022
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

1 participant