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/proto-loader: issue when importing proto files if file directory is `google/protobuf/<file>`

See original GitHub issue

I use a set of protobuf interfaces defined by Google such as google.protobuf.Struct. I have these files under the directory google/protobuf/. Since I moved to @grpc/proto-loader I started having issues using message structures from these files in other protobuf interfaces. The content from fields using messages from these files is always empty. After several tests I discovered that this does not happen if the path is not google/protobuf. If I change it to google_1/protobuf or google/protobuf_1 it works! I was not experiencing this issue when loading protos the “old way” - grpc.load({ protoRoot, filePath}). Could this be some reserved keyword conflict while loading the files?

My grpc loader options:

const packageDef = protoLoader.loadSync(filepath, {
     arrays:false,
     defaults: false,
     keepCase: true,
     includeDirs: [protoRoot]
});

The protos are defined here. grpc version: 1.11.3 @grpc/proto-loader version: 0.1.0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
nicolasnoblecommented, May 9, 2018

You are correct. The only reason @grpc/proto-loader exists is for exactly the kind of situation you see yourself in right now. If you’ve determined that the issue is in fact in protobufjs, and opening an issue there, I will then close these two here.

For cross-reference, you have opened issue https://github.com/dcodeIO/protobuf.js/issues/1042.

0reactions
respinhacommented, May 9, 2018

Tested locally with plain protobuf.js and same problem occurs. I will post an issue there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot import google's proto with @grpc/proto-loader
The problem here is that the path that protoFiles('rpc') returns doesn't work with the import line in your .proto file.
Read more >
Language Guide (proto3) | Protocol Buffers - Google Developers
The first line of the file specifies that you're using proto3 syntax: if you ... The protocol compiler searches for imported files in...
Read more >
Basics tutorial | Node - gRPC
Define a service in a .proto file. Use the Node.js gRPC API to write a simple client and server for your service.
Read more >
google-protobuf - Protocol Buffers - npm
This directory contains the JavaScript Protocol Buffers runtime library. ... If npm is not being used, as of 3.3.0, the files needed are ......
Read more >
How to Easily use GRPC and Protocol Buffers with NodeJS
Now if getEmployee and greetEmployee functions are located in different address ... Inside the proto folder, create a file with the name ...
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