Minimal Cloudflare Worker demonstrating that RpcSerialization.msgPack silently fails when decoding messages with 3+ same-structure objects.
new Packr() with no options enables msgpackr's record/structure path (undefined != false is true). When the Unpackr encounters 3+ objects with the same key structure in a single decode, it JIT-compiles a fast reader via new Function() — which CF Workers blocks during request handling.
The error is silently swallowed by RpcSerialization.msgPack's catch { return [] }.
- Cloudflare account (miniflare does not enforce
new Function()restriction) allow_eval_during_startupcompat flag (default forcompatibility_date >= 2025-06-01)
npm install
npx wrangler deploy
curl https://<your-worker>.workers.dev{
"bug": {
"raw_error": "EvalError: Code generation from strings disallowed for this context",
"rpcSerialization_result": [],
"rpcSerialization_length": 0,
"silently_swallowed": true
},
"fix": {
"useRecords_false_result": [{ "_tag": "Chunk", ... }],
"useRecords_false_length": 1
}
}bug.raw_error— the actual EvalError fromnew Function()being blockedbug.silently_swallowed—truebecausecatch { return [] }hides the errorfix—{ useRecords: false }prevents the JIT path entirely
// Before (silently fails on CF Workers with nested objects)
RpcSerialization.layerMsgPack
// After
RpcSerialization.layerMsgPack({ useRecords: false })