fix: edge runtime WASM bindings for satori yoga and resvg#492
Merged
fix: edge runtime WASM bindings for satori yoga and resvg#492
Conversation
- Switch yoga WASM from yoga-wasm-web to satori/yoga.wasm (correct binary for satori 0.16+) - Add #og-image/yoga-wasm alias in compatibility.ts - Fix oxc-walker AST type names in patchWebAssemblyInstantiate - Add vercel-edge Process polyfill patch (Proxy + private class fields) - Mock unused renderer bindings to avoid bundling large WASM (e.g. takumi 3.4MB) - Fix cloudflare WASM lazy config (let Nitro's preset fill in lazy: false) - Add vercel-edge-satori e2e test fixture
…safer codegen - Use shared `importWasm` util in resvg/wasm.ts and satori/wasm.ts instead of inline double-await - Fix race condition in instances.ts: use singleton promise for concurrent first calls - Add null guard to useSatori consistent with useResvg - Use temp variable in patchWebAssemblyInstantiate to avoid triple arg1 evaluation - Log err.stack directly instead of redundant message + stack - Parallelize hash resolution with Promise.all
Collaborator
Author
Code reviewFound 1 issue:
🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Add type narrowing for callee.property (union includes types without .name) and null guards for destructured arguments array elements.
…n CF Workers $fetch with the worker's own origin triggers CF Workers' self-referencing subrequest restriction. Throw a clear error instead when neither ASSETS binding nor event.$fetch is available.
bfe88a2 to
985d846
Compare
Contributor
|
@harlan-zw can this be released on the v3.x release? We're currently also getting a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
Related to #434
❓ Type of change
📚 Description
Edge runtimes (Cloudflare Workers, Vercel Edge) were failing to generate OG images because satori's yoga WASM binary was resolved from
yoga-wasm-webinstead ofsatori/yoga.wasm— the correct binary that matches satori's bundled Emscripten glue. Also fixes Cloudflare Workers blockingWebAssembly.instantiate()by patching calls to use synchronousnew WebAssembly.Instance()for pre-compiled modules.Key changes:
satori/yoga.wasmvia#og-image/yoga-wasmaliasWebAssembly.instantiate→new WebAssembly.Instanceusing oxc-walker AST traversal