An experiment with running wasm-vips on Cloudflare Workers.
Warning
wasm-vips in its current form can never run on Cloudflare workers.
See kleisauke/wasm-vips#2 (comment)
for details.
This experiment currently fails with:
worker.js onmessage() captured an uncaught exception: RuntimeError: memory access out of bounds
RuntimeError: memory access out of bounds
at g_thread_proxy (wasm://wasm/0281634a:wasm-function[6132]:0x3c2b79)
at h.invokeEntryPoint (polyfill.js:1816:23)
at onmessage (polyfill.js:4353:35)
at callFun (polyfill.js:4404:9)
at Worker2.runPostMessage (polyfill.js:4410:7)
Since the WebAssembly.Memory
in the Web Worker polyfill is not shared with the worker that instantiated
wasm-vips. See this FIXME
:
cf-worker-wasm-vips/lib/polyfill.ts
Line 60 in 9f0c4c8
Cloudflare only allows to pass a string or binary data via WebSocket connections, which won't work for Emscripten's pthread integration. It requires an API that allows sharing Wasm memory between workers.