Description
When a scheduled reducer (timer) fires on the server, the TypeScript SDK crashes with:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'reducerName') at index-CCjekHwN.js:23:204433 at Array.find ()
This occurs because TransactionUpdate messages from scheduled reducers don't include reducerInfo, but the SDK unconditionally accesses reducerInfo.reducerName in multiple places.
Affected Lines (v1.11.0)
In `dist/index.mjs`:
- Line 4850: [(t2) => t2.name === reducerInfo.reducerName](cci:1://file:///****/client/src/lib/localCache.ts:280:2-282:3)
- Line 4887: `name: reducerInfo.reducerName,`
- Line 4905: `reducerInfo.reducerName,`
Suggested Fix
Use optional chaining:
// Before
reducerInfo.reducerName
// After
reducerInfo?.reducerName
Reproduction Steps
Create a Rust module with a scheduled reducer
Connect TypeScript client and subscribe to tables
Wait for the scheduled reducer to fire
Observe crash in browser console
Workaround
We patch the SDK after install in our postinstall script:
javascript
content.replace(
/reducerInfo\.reducerName/g,
'(reducerInfo==null?void 0:reducerInfo.reducerName)'
);
Environment
SpacetimeDB SDK: 1.11.0
Platform: Browser (Vite/React)
Server: maincloud
Description
When a scheduled reducer (timer) fires on the server, the TypeScript SDK crashes with:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'reducerName') at index-CCjekHwN.js:23:204433 at Array.find ()This occurs because
TransactionUpdatemessages from scheduled reducers don't includereducerInfo, but the SDK unconditionally accessesreducerInfo.reducerNamein multiple places.Affected Lines (v1.11.0)
Suggested Fix
Use optional chaining:
Reproduction Steps
Workaround
We patch the SDK after install in our postinstall script:
Environment
SpacetimeDB SDK: 1.11.0
Platform: Browser (Vite/React)
Server: maincloud