-
Notifications
You must be signed in to change notification settings - Fork 59
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
TypeError: Invalid URL string. Used initWasm()
.
#288
Comments
initWasm()
.TypeError: Invalid URL string.
Used initWasm()
.
TypeError: Invalid URL string.
Used initWasm()
.initWasm()
.
Try: See: https://jross.me/improving-wasm-imports-with-wrangler-and-cloudflare-workers/ |
@yisibl |
The version of
|
I'm using this:
|
Seems like the worker size gets too big and is unable to deploy then, I tried loading it from a remote URL but then I get stuck with Code looks something like this const initResvgWasm = async () => {
try {
await initResvg(
// (await import('@resvg/resvg-wasm/index_bg.wasm')).default
await fetch('https://unpkg.com/@resvg/resvg-wasm/index_bg.wasm').then((response) =>
response.arrayBuffer(),
),
);
} catch (e) {
if (e instanceof Error && !e.message.includes('Already initialized')) {
throw e;
}
}
};
const initYogaWasm = async () => {
const yoga = await initYoga(
// (await import('yoga-wasm-web/dist/yoga.wasm')).default
await fetch('https://unpkg.com/yoga-wasm-web/dist/yoga.wasm').then((response) =>
response.arrayBuffer(),
),
);
initSatori(yoga);
}; And worker logs look something like this:
|
Using version 2.6.2 worked for me import { initWasm } from '@resvg/resvg-wasm';
let initialized = false;
export async function initResvgWasm() {
try {
if (initialized) return;
const wasmResponse = await fetch('https://unpkg.com/@resvg/[email protected]/index_bg.wasm');
const wasmArrayBuffer = await wasmResponse.arrayBuffer();
await initWasm(wasmArrayBuffer);
initialized = true;
} catch (error) {
console.error('Resvg wasm not initialized', error);
}
} |
Hello, An error occurred while developing a dynamic image generation function using
@resvg/wasm
and satori on Remix.https://github.com/tsuki-lab/remix-satori-resvg-cloudflare/blob/main/app/routes/og.tsx#L24 .
Error reproduction environment
Deploy to cloudflare pages. And reproduce it locally.
Repository
https://github.com/tsuki-lab/remix-satori-resvg-cloudflare
The text was updated successfully, but these errors were encountered: