-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get
on repeated field erroring with TypeError
#1379
Comments
@jack-tutor Thanks for the report! It does sound like a mis-behavior indeed :) I wonder if you can, help identify the exact line of code which throws that error? It would be helpful if you can try not further obfuscate the JS bundle using something like "development" mode (like by replacing this line). It's ok if the line is already obfuscated, but at least we can confirm where the error is coming from. I'd guess it's happening in the protobuf-javascript library, since from what i can tell from my manual test, the generated code would simply call into the /**
* repeated Bar bars = 10;
* @return {!Array<!proto.grpc.gateway.testing.Bar>}
*/
proto.grpc.gateway.testing.EchoResponse.prototype.getBarsList = function() {
return /** @type{!Array<!proto.grpc.gateway.testing.Bar>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.grpc.gateway.testing.Bar, 10));
}; Which is implemented below: I'm guessing the error you saw happens might be happening in this line: |
I have been encountering a problem lately where if I have a repeated field - and the given message does not populate any values in the repeated field - calling the getter for that field on that message will error:
The error looks like:
I am using a python backend to generate the messages.
For example, it would occur with protos:
the message created as
Foo(bars=[])
in pythonthen this:
would raise the
TypeError
- but if the message had happened to be created asFoo(bars=[Bar()])
, then no error would occur.I am running
grpc-web 1.4.2
,grpcio = "^1.56.0"
in python, and protoc3.20.1
I do not expect that empty repeated messages are generally broken as this would certainly have been raised as an issue if it was true - but I'm looking for potential causes, debugging steps I should execute, and creating this issue for anyone else that might run into this.
Thanks
The text was updated successfully, but these errors were encountered: