clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.21k stars 104 forks source link

Update `bad {} signature for {:?}` error message for ill-typed module exports #1427

Open cloutiertyler opened 3 weeks ago

cloutiertyler commented 3 weeks ago
Error: bad call_reducer signature for "__call_reducer__"; expected FuncSig { params: [I32, I32, I32, I64, I32], results: [I32] } got FuncSig { params: [I32, I32, I64, I32], results: [I32] }

This error almost always means a bindings dependency which doesn't match the host version. We should update the error message to point users in that direction, with text like, "Does your module's spacetimedb dependency match the server's SpacetimeDB version?"

cloutiertyler commented 3 weeks ago

@gefjon Does this require making any API breaking changes to the publish API or no? i.e. do we already have a way of sending back error information?

gefjon commented 3 weeks ago

I would bounce this to @kim , since the challenge is with cloud. With standalone it should be easy; we'd just return a better body with the error HTTP response.

kim commented 3 weeks ago

We do generally propagate back errors in stringly repr.

Note that this error can occur whenever a module is instantiated -- which may happen after it was published successfully, but the server restarted with an incompatible host ABI. I wonder if it should not be detected earlier? For example, by storing the ABI version in st_module, so we don't even try to instantiate the module if it doesn't match.