Questions tagged [protoc]

protoc is the compiler for .proto files. It generates language bindings for the messages and/or RPC services from .proto files. protoc is a native executable, the scripts under this directory build and publish a protoc executable (a.k.a. artifact) to Maven repositories. The artifact can be used by build automation tools so that users would not need to compile and install protoc for their systems.

taken from google documentation

387 questions
1
vote
1 answer

Docker image build fails: "protoc-gen-grpc-web: program not found or is not executable"

i inherited a project with several microservices running on kubernetes. after copying the repo and running the steps that the previous team outlined, i have an issue building one of the images that i need to deploy. the script for the build is: cd…
Saile
  • 115
  • 1
  • 11
1
vote
1 answer

gogo/protobuf avoid allocating new objects for repeated field

Consider a simple protobuf file: syntax = "proto3"; package tutorial; import "github.com/gogo/protobuf@v1.3.2/gogoproto/gogo.proto"; message Point { uint32 timestamp = 1; double value = 2; } message Metric { string metric = 1; repeated…
Bes Dollma
  • 383
  • 3
  • 10
1
vote
1 answer

Incomplete _pb2.py file generated by python protobuf?

I want to generate _pb2.py files from .proto files and use them for bigquery data upload. The proto file contains simple messages with only string and int32 fields like: syntax = "proto2"; package duplicate; message duplicate { required int32 …
ChrisChros
  • 11
  • 2
1
vote
1 answer

How to get the import correct when creating protocol buffer?

I am relatively new to protocol buffers and python, so I stumbled upon a problem described below. (I've done plenty of research in this issue, but found no solution) The relevant hirarchy of my code: . └── MainFolder ├── main.py ├──…
1
vote
1 answer

How to build classes protobuf (protoc) from a go based project (cortex)

I'm trying to follow the instructions here to create python classes from a protobuf defanition found here. When I run: protoc -I=. --python_out=target cortex.proto I'm stuck with an error: cortex.proto:7:1: Import…
Philip Couling
  • 13,581
  • 5
  • 53
  • 85
1
vote
0 answers

Getting multiple errors while trying generate grpc files using protoc-gen-entgrpc

Even after installing protoc-gen-entgrpc with this command go install entgo.io/contrib/entproto/cmd/protoc-gen-entgrpc@latest still getting multiple errors with protoc-gen-entgrpc This are the errors I got, Could not make proto path relative:…
M_x
  • 782
  • 1
  • 8
  • 26
1
vote
1 answer

Module XXX found, but does not contain package XXX

Not so familiar with Golang, it's probably a stupid mistake I made... But still, I can't for the life of me figure it out. So, I got a proto3 file (let's call it file.proto), whose header is as follows: syntax = "proto3"; package…
Justin Iurman
  • 18,954
  • 3
  • 35
  • 54
1
vote
1 answer

Error while generating grpc files (--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.)

I’m trying to run the following command to generate grpc files: protoc --proto_path=$PROTO_PATH --plugin=protoc-gen-grpc=$PLUGIN_GRPC --grpc_out=$OUT/grpc $PROTO_FILES This results in the following…
juuubbb
  • 139
  • 4
  • 14
1
vote
2 answers

Running protoc in Python subprocess

I have my .proto. files defined in a folder workspace_directory/sub_directory/proto_files. When I run: protoc --python_out=workspace_directory -I workspace_directory/sub_directory/proto_files workspace_directory/sub_directory/proto_files/* the…
Trashfire
  • 118
  • 1
  • 6
1
vote
2 answers

How to use camelCase JSON tags for marshaling structs in gRPC generated files in Go?

take the struct below as an example, type Foo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields IsBar bool …
Ala_b
  • 21
  • 3
1
vote
1 answer

protobuf with Go not able to compile to the desired folder with paths=source_relative

I want to generate .pb.go files to the ./pb folder. I have my .proto files under ./proto folder. I ran this command in my root folder: protoc --go_out=./pb/ --go_opt=paths=source_relative ./proto/*.proto However, my .go files always end up under…
Jyhonn
  • 63
  • 1
  • 7
1
vote
1 answer

Protobuf compiler for proto3 not working properly from maven compiler

I have a proto file defined with syntax = "proto3" where I have a field optional String name = 0; for example. When compiling the file with protoc installed on the machine I get Explicit 'optional' labels are disallowed in the Proto3 syntax. To…
1
vote
0 answers

grpc protobuf error cannot find module in nestjs

I have generated ts protobuf via protoc command protoc --plugin=\"protoc-gen-ts=.\\node_modules\\.bin\\protoc-gen-ts.cmd\" --plugin=\"protoc-gen-grpc=.\\node_modules\\.bin\\grpc_tools_node_protoc_plugin.cmd\"…
AMit SiNgh
  • 325
  • 4
  • 17
1
vote
0 answers

Generate js file from proto file with protoc v21.1

Command used - protoc.exe --js_out=import_style=commonjs,binary:. employees.proto Error - 'protoc-gen-js' is not recognized as an internal or external command, operable program or batch file. Version Used - protoc.exe --version …
Parzival
  • 585
  • 2
  • 12
1
vote
0 answers

Parse oneof typefields in golang Protoc plugin

I am building a protoc compiler plugin and I am stuck reading the contents of oneof fields. I have a variable of type descriptorpb.OneofDescriptorProto but I don't know how to get a list of the contained messages. Does someone know how to access…