grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.65k stars 764 forks source link

"--js_out: options: mode is required" error on code generation #1251

Closed metapone closed 2 years ago

metapone commented 2 years ago

Using protoc v21.0 with grpc-web v1.3.1 will yield error "--js_out: options: mode is required". Downgrading to protoc v3.20.1 will temporarily solve this issue.

Here's my full protoc command: protoc -I=./ Protos/test.proto --js_out=import_style=commonjs:. --grpc-web_out=import_style=typescript,mode=grpcwebtext:.

sampajano commented 2 years ago

Thanks so much for bringing this up! Will check and get back! Thanks! :)

sampajano commented 2 years ago

Found out more details :) This is actually an intentional change, as announced here: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#javascript

A new protoc binary will be provided separately at https://github.com/protocolbuffers/protobuf-javascript to provide --js_out functionalities. It's not ready yet and i will update this thread when it is..

For now, please use the v3.20.1 (link) release of the protoc binary..

Thanks for your understanding! :)

sampajano commented 2 years ago

A new separate JS compiler is now provided by protobuf-javascript: https://github.com/protocolbuffers/protobuf-javascript/releases

I'll update the documentations to point to it instead :)

guptaaashutosh commented 9 months ago

You need to install protoc-gen-js globally to generate gRPC code in javascript using bellow command npm install -g protoc-gen-js

Then, bellow command to generate gRPC code protoc --js_out=import_style=commonjs,binary:. your_proto_file_name.proto