Closed
Description
I'm working on a Next.Js app, trying to display realtime information following the sample in (https://hyperledger.github.io/iroha-2-docs/guide/get-started/javascript.html#_8-visualizing-outputs-in-web-ui).
Im using CommonJS, this is my code to initialize the crypto library:
// lib/crypto.js or lib/crypto.ts
import { crypto, init } from "@iroha2/crypto-target-web";
let isInitialized = false;
async function initCrypto() {
if (!isInitialized) {
console.log("initializing crypto...");
await init();
isInitialized = true;
}
}
// Initialize crypto immediately
initCrypto();
export { crypto };
but when start the app, I get this error:
⨯ unhandledRejection: TypeError: Failed to parse URL from /_next/static/media/iroha_crypto_bg.8bf5c350.wasm
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at async init (webpack-internal:///(ssr)/./node_modules/@iroha2/crypto-target-web/dist/wasm-pkg/iroha_crypto.js:1558:45)
at async initCrypto (webpack-internal:///(ssr)/./app/src/crypto.js:12:9) {
[cause]: TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:405:5)
at new URL (node:internal/url:611:13)
at new Request (node:internal/deps/undici/undici:7132:25)
at fetch2 (node:internal/deps/undici/undici:10715:25)
at Object.fetch (node:internal/deps/undici/undici:11574:18)
at fetch (node:internal/process/pre_execution:229:25)
at doOriginalFetch (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:440:24)
at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:589:24)
at async init (webpack-internal:///(ssr)/./node_modules/@iroha2/crypto-target-web/dist/wasm-pkg/iroha_crypto.js:1558:45)
at async initCrypto (webpack-internal:///(ssr)/./app/src/crypto.js:12:9) {
input: '/_next/static/media/iroha_crypto_bg.8bf5c350.wasm',
code: 'ERR_INVALID_URL'
}
}
The init
is failing so the crypto module fails to load. Any ideas?
Metadata
Metadata
Assignees
Labels
No labels