-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Bug: WASM Compilation Fails - "No matching export in node:buffer"
Description
Workflows fail to compile to WASM with error: could not load module 'node:buffer'
This occurs because in the cre-sdk-typescript:
prepare-runtime.tsimportsBufferfromnode:buffer- Javy (the JS→WASM compiler) cannot load Node.js built-in modules
- Bun bundler uses browser polyfills instead of Node.js modules (missing
--target=node)
Steps to Reproduce
# 1. Create new workflow using ts-sdk
cre init test-workflow
cd test-workflow
# 2. Create simple workflow
# 3. Run simulation
cre workflow simulate . --broadcast --target local-simulation
Error:
error: No matching export in "node:buffer" for import "Buffer"
Error: could not load module 'node:buffer'
Environment
- OS: macOS (Darwin 24.4.0)
- Bun: 1.1.30
- SDK: @chainlink/cre-sdk@0.0.9-alpha
- CRE CLI: (cre version v0.6.4-alpha)
Proposed Fix
1. packages/cre-sdk/src/sdk/utils/prepare-runtime.ts - Buffer polyfill
2. packages/cre-sdk/scripts/src/compile-to-js.ts - Add --target=node
Workaround
Use local SDK build with fixes applied.The fixes should be implemented in the ts-sdk. I can create a PR with the solution for you to review if there are no issues.
tag @zeuslawyer
Metadata
Metadata
Assignees
Labels
No labels