Skip to content
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

Getting error when trying to get missing field #2725

Open
ArtTemiy opened this issue Apr 14, 2024 · 1 comment
Open

Getting error when trying to get missing field #2725

ArtTemiy opened this issue Apr 14, 2024 · 1 comment

Comments

@ArtTemiy
Copy link

ArtTemiy commented Apr 14, 2024

Hello! I was trying to get a missing field of a message and expected to receive a undefind, but got an error saying TypeError: Cannot read properties of null (reading '10') (number for corresponding field).
Turned out that the problem occurred because wrappers_ field of the message was equal to null. In the jspb.Message.getWrapperField there is check to prevent it, looking like a.wrappers_ || (a.wrappers_ = {});. But for some strange reason that doesn't work and assignment left wrapper_ filed with null (I was trying to make it by myself before calling getMyField, it still didn't help).

I receive the "invalid" message from server, thats why wrappers_ set to null (if I create it with new MyMessage wrappers_ is set to {} and everything works fine)

@murgatroid99
Copy link
Member

It looks like you're talking about the API of code generated with grpc-tools. We don't control the message code generation, we just redistribute it. That code lives in this repository so you're more likely to get answers there. However, note that the version distributed in grpc-tools is out of date, so it is possible that this problem has been fixed there and we haven't picked up the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants