grpc / grpc/grpc-node

Failed to parse server response when I try to read a stream

Open
#1,022 13 comments 0 reactions 0 assignees View on GitHub
package: @grpc/proto-loader package: grpc
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

### Problem description
I'm using generated static bindings from https://github.com/liftbridge-io/liftbridge-grpc/blob/0877a0cacb7a721e2e19280cff126dc2ed51912d/api.proto to create a Liftbridge Node.js client that will create a stream and publish some messages and subscribe to them (Liftbridge is a kind of lightweight Kafka), and I run into an `Error: 13 INTERNAL: Failed to parse server response` error consistently whenever I try to consume the [`Subscribe` stream](https://github.com/liftbridge-io/liftbridge-grpc/blob/0877a0cacb7a721e2e19280cff126dc2ed51912d/api.proto#L129).

### Reproduction steps
1. `docker run -p 4222:4222 -ti nats:latest --debug --trace` in a window.
2. `go get github.com/liftbridge-io/go-liftbridge` and then `$GOPATH/bin/liftbridge --raft-bootstrap-seed --nats-servers nats://localhost:4222 --level debug` in another window.
3. Clone my repo from `https://github.com/paambaati/node-liftbridge.git` in yet another window.
1. `yarn install` or `npm install`
2. `yarn run debug` or `npm run debug` to run the debug script that reproduces this issue.

The [debug script](https://github.com/paambaati/node-liftbridge/blob/master/src/debug.ts) attempts to create a new stream, then publish a few messages, then subscribes to the same stream (subject) and then publishes a few more messages.

Expected output — Each published message should be printed to console ([see relevant lines](https://github.com/paambaati/node-liftbridge/blob/ad04598126778c5944d5b78a5f153ccc927b1378/src/debug.ts#L37-L42)).

Actual output —

```
Error: 13 INTERNAL: Failed to parse server response
at Object.exports.createStatusError (~/node-liftbridge/node_modules/grpc/src/common.js:91:15)
at ClientReadableStream._emitStatusIfDone (~/node-liftbridge/node_modules/grpc/src/client.js:233:26)
at ClientReadableStream._receiveStatus (~/node-liftbridge/node_modules/grpc/src/client.js:211:8)
at Object.onReceiveStatus (~/node-liftbridge/node_modules/grpc/src/client_interceptors.js:1272:15)
at InterceptingListener._callNext (~/node-liftbridge/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (~/node-liftbridge/node_modules/grpc/src/client_interceptors.js:618:8)
at ~/node-liftbridge/node_modules/grpc/src/client_interceptors.js:1029:24 {
code: 13,
metadata: undefined,
details: 'Failed to parse server response'
}
```

### Environment
- macOS 10.14.16
- Node 12.9.1
- Node installation method - [`fnm`](https://github.com/Schniz/fnm)
- Clang 10.0.1 (clang-1001.0.46.4)
- grpc@1.23.3

### Additional context
1. The static bindings were generated by a script - [see relevant command here](https://github.com/paambaati/node-liftbridge/blob/ad04598126778c5944d5b78a5f153ccc927b1378/scripts/generate_grpc_code.sh#L48-L56). The bindings are checked-in at [`grpc/generated`](https://github.com/paambaati/node-liftbridge/tree/master/grpc/generated).

2. The Go version of the client I'm developing (see [go-liftbridge](https://github.com/liftbridge-io/go-liftbridge)) **can** in fact `Subscribe` to the messages `Publish`ed by my Node.js debug script and print all the `Message`s correctly! I used the example subscribe program at https://github.com/liftbridge-io/go-liftbridge/blob/master/example/lift-sub/subscribe.go to verify this 😮

3. I ran a full verbose trace of my debug script, and here's the output — https://gist.github.com/paambaati/7884b119eee47fafa436f74db8b59edc. I've padded the debug script's stdout with a lot of new lines so it is a little easier to separate them from the GRPC traces.

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.