62e7ed0a77
The stack trace finally showed the truth: the error was in our own decodeKrpcType, not in protobufjs. The kRPC server omits the `return_type` field for procedures that have no return value (e.g. AddStream, RemoveStream, all the setters). protobufjs decodes missing message fields as null. Our cache then called `decodeKrpcType(null)`, which did `null.code` and threw. The null.code error message was a red herring all along — it looked like protobufjs was looking up an enum descriptor, but it was actually just our code accessing .code on a null parameter. The protobufjs fixes (uint32 instead of nested-enum, adding the game_scenes field) were real and needed — but they weren't the cause of THIS particular failure mode. Fix: - decodeKrpcType accepts null/undefined and returns a NONE type (code 0) in that case - Added a regression test in services.test.ts that builds a fake ServiceCache with a procedure whose returnType is null