Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kleisauke/cf-worker-wasm-vips
Experiment with running wasm-vips on Cloudflare Workers.
https://github.com/kleisauke/cf-worker-wasm-vips
Last synced: 18 days ago
JSON representation
Experiment with running wasm-vips on Cloudflare Workers.
- Host: GitHub
- URL: https://github.com/kleisauke/cf-worker-wasm-vips
- Owner: kleisauke
- License: mit
- Created: 2022-06-08T19:38:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-17T10:44:07.000Z (about 1 year ago)
- Last Synced: 2024-10-10T00:13:28.453Z (about 1 month ago)
- Language: TypeScript
- Size: 33.2 KB
- Stars: 8
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cf-worker-wasm-vips
An experiment with running [wasm-vips](https://github.com/kleisauke/wasm-vips)
on [Cloudflare Workers](https://workers.cloudflare.com/).> [!WARNING]
> wasm-vips in its current form can never run on Cloudflare workers.
> See https://github.com/kleisauke/wasm-vips/issues/2#issuecomment-1187416552
> for details.## Status
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](
lib/polyfill.ts) is not shared with the worker that instantiated
wasm-vips. See this `FIXME`:
https://github.com/kleisauke/cf-worker-wasm-vips/blob/9f0c4c837a7ca85b54ddeb26d97325c70bebda1b/lib/polyfill.ts#L60Cloudflare only allows to pass a string or binary data via
[WebSocket connections](
https://github.com/cloudflare/workerd/blob/cae438f99d3e070e5530dbf42f338ee3392e68ae/src/workerd/api/web-socket.h#L62),
which won't work for [Emscripten's pthread](
https://emscripten.org/docs/porting/pthreads.html) integration.
It requires an API that allows sharing Wasm memory between workers.