question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gRPC Client does not send fields when field name contains underscore

See original GitHub issue

Bug Report

Current behavior

Having a Nestjs gRPC Client using a .proto file that contains message field names with an underscore leads to those fields not being sent and thus falling back to their defaults.

Input Code

Does not work:

message ConfigNew {
    int32 id = 1;
    string test_string = 2;
}

works:

message ConfigNew {
    int32 id = 1;
    string teststring = 2;
}

Expected behavior

Support for message field names, regardless whether they contain an underscore or not.

Environment


- Nest version: 7.2.0
- Node version: v12.16.2
- Platform: Linux

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
RobertB93commented, Jun 17, 2020

set keepCase option to true in microservice options. I think this option should be true by default, it’s not at the moment. Like this:

app.connectMicroservice<MicroserviceOptions>({
    transport: Transport.GRPC,
    options: {
      package: 'test',
      protoPath: 'path/to/proto',
      loader: { keepCase: true },
    },
  });

Yes, you are right! It works as expected when setting the loader options, thank you. I think we should either enable this by default (if applicable) or at least mention in the docs, what do you guys think?

2reactions
kamilmysliwieccommented, Jun 18, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

NestJS gRPC empty return - Stack Overflow
gRPC Client does not send fields when field name contains underscore. You should delete all underscores from access_token and then works.
Read more >
gRPC - Microservices - A progressive Node.js framework
Warning gRPC Client will not send fields that contain underscore _ in their names unless the keepCase options is set to true in...
Read more >
How to Design Messages for gRPC Services in .NET Core
Defining your gRPC service using the Protocol Buffers specification is pretty easy. There are just a couple of things to be aware of...
Read more >
Style Guide | Protocol Buffers - Google Developers
Use CamelCase (with an initial capital) for message names – for example, SongServerRequest . Use underscore_separated_names for field names (including oneof ...
Read more >
Customizing your gateway | gRPC-Gateway - GitHub Pages
You can have Elasticsearch-style ?pretty support in your gateway's ... messages with fields named pretty ; also, this example code does not remove...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found