grpc / grpc/grpc-web

TypeError: b is not a function. (In 'b(null, d)', 'b' is undefined)

Open
#1,044 7 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
802
Avg merge
1d 7h
Merged PRs (30d)
5

Description

Hi there,

I'm having some issues invoking gRPC-web calls from my React application. Invoking my RPC works correctly and the server receives the request without issue, however an error appears in my console on every request.

```
index.js:60 Uncaught TypeError: b is not a function
at Array. (index.js:60)
at yc (index.js:53)
at S. (index.js:51)
at Ib (index.js:34)
at O (index.js:33)
at oc (index.js:42)
at S.push../node_modules/grpc-web/index.js.S.O (index.js:40)
at S.push../node_modules/grpc-web/index.js.S.K (index.js:40)
```

I'm running a gRPC server in Go with a React application communicating with the Go server via the Envoy proxy.

I compile my Proto using the following command:
```
protoc \
--js_out=import_style=commonjs,binary:web-client/src/ \
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:web-client/src/ \
proto/myapp.proto
```

```
$ protoc --version
libprotoc 3.14.0
```

and I build my request from React like so:
```
const { GetMessagesRequest, Message } = require('../../proto/myapp_pb.js');
const { MyappClient } = require('../../proto/myapp_grpc_web_pb');

const myappService = new MyappClient('http://localhost:8080');
const msg = new Message()

const meta = {
"authorization": "fake_123456",
}

await myappService.broadcast(msg, meta)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.