Grpc-web: helloworld example serializeBinary is not a function

Created on 23 May 2019  路  6Comments  路  Source: grpc/grpc-web

I think this is the same issue as #377 but no solution has been provided there. Any advice is appreciated.

What I did

I cloned the repository and and followed the instructions in the README. I executed

sudo mv ~/Downloads/protoc-gen-grpc-web-1.0.4-darwin-x86_64   /usr/local/bin/protoc-gen-grpc-web
chmod +x /usr/local/bin/protoc-gen-grpc-web
protoc -I=. helloworld.proto   --js_out=import_style=commonjs:.   --grpc-web_out=import_style=commonjs,mode=grpcwebtext:.
npm install
npx webpack client.js
npx webpack client.js

and get the following error when loading the website

Uncaught TypeError: t.serializeBinary is not a function
    at MethodInfo.a (main.js:8)
    at we.N (main.js:8)
    at n.helloworld.GreeterClient.sayHello (main.js:8)
    at Object.<anonymous> (main.js:1)
    at r (main.js:1)
    at main.js:1
    at main.js:1

What I expected

I expected the code to at least fail to connect to the server or function properly.

Most helpful comment

Try:

protoc -I=. helloworld.proto   --js_out=import_style=commonjs,binary:.   --grpc-web_out=import_style=commonjs,mode=grpcwebtext:.

Had a similar problem earlier today. For some reason, the protoc I'm using requires passing binary into --js_out

All 6 comments

@langep Have you run the gRPC backend server and the Envoy proxy?

@stanley-cheung Yes, I tried it while the gRPC backend server and Envoy proxy where running following the docs on how to start it on MacOS.

Try:

protoc -I=. helloworld.proto   --js_out=import_style=commonjs,binary:.   --grpc-web_out=import_style=commonjs,mode=grpcwebtext:.

Had a similar problem earlier today. For some reason, the protoc I'm using requires passing binary into --js_out

I had similar issue and using binary for --js_out options worked. Although I still don't fully understand what the issue was.

Sorry I am declaring Bug Bankruptcy on some of these older issues. If this is still reproducible with a newer release, please reopen a new issue.

It still doesn't seem to be working without using binary option. (Release 1.1.0)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TBoshoven picture TBoshoven  路  4Comments

NiNJAD3vel0per picture NiNJAD3vel0per  路  3Comments

jmzwcn picture jmzwcn  路  6Comments

barrymichaeldoyle picture barrymichaeldoyle  路  4Comments

peteringram0 picture peteringram0  路  5Comments