We hit a runtime bug in the JS spacetimedb package (2.0.4) that breaks published databases with existing snake_case schemas.
Symptom
spacetime publish succeeds
- the new instance then fatally crashes on first reducer call
- subsequent CLI calls fail with
403 / The instance encountered a fatal error
- logs show panics like
Uncaught No such index
What we observed
It looks like internal runtime index/source names are being derived from JS accessor keys instead of canonical table/column names.
Example:
- table accessor:
cardDetails
- field/accessor:
nameKey
- runtime expected:
cardDetails_nameKey_idx_btree
- actual published DB index name:
card_details_name_key_idx_btree
Another example:
- runtime expected:
runtimeIslandStates_ownerId_idx_btree
- actual DB index name:
runtime_island_states_owner_id_idx_btree
So the runtime looks up a non-existent index and panics.
Why we think this is the cause
We patched the installed runtime in node_modules/spacetimedb/dist/server/index.mjs with these two changes:
- Use canonical column names when building the index column list
colNameList.push(row.row[elem.name]?.columnMetadata?.name ?? elem.name);
instead of:
colNameList.push(elem.name);
2. Use canonical table name instead of accessor name when building index source names
const sourceName = index.sourceName = `${tableName}_${colS}_idx_${index.algorithm.tag.toLowerCase()}`;
instead of:
const sourceName = index.sourceName = `${accName}_${colS}_idx_${index.algorithm.tag.toLowerCase()}`;
After that patch:
- reducer calls stopped panicking
- config reducers like set_storage_config worked again
- runtime smoke tests passed on both staging and live published databases
## Environment
- spacetimedb CLI/runtime version 2.0.4
## Expected behavior
Runtime index/source-name resolution should be based on canonical schema names, not JS accessor identifiers.
We hit a runtime bug in the JS
spacetimedbpackage (2.0.4) that breaks published databases with existing snake_case schemas.Symptom
spacetime publishsucceeds403/The instance encountered a fatal errorUncaught No such indexWhat we observed
It looks like internal runtime index/source names are being derived from JS accessor keys instead of canonical table/column names.
Example:
cardDetailsnameKeycardDetails_nameKey_idx_btreecard_details_name_key_idx_btreeAnother example:
runtimeIslandStates_ownerId_idx_btreeruntime_island_states_owner_id_idx_btreeSo the runtime looks up a non-existent index and panics.
Why we think this is the cause
We patched the installed runtime in
node_modules/spacetimedb/dist/server/index.mjswith these two changes: