grpc-node icon indicating copy to clipboard operation
grpc-node copied to clipboard

Both 'error' and 'end' events emitted for a server-stream call

Open asakiasako opened this issue 2 years ago • 0 comments

Problem description

I'm using node.js as client and python as server, and make a server-side streaming call. When I raise an Error in the server side handler, the 'error' event emitted and then the 'end' event is emitted too. But only one of the 'error' or 'end' should be emitted according to the document: https://grpc.io/docs/languages/node/basics/#streaming-rpcs

stream = client.serverStreamCall(msg)
stream.on('error', (err) => {
  console.log('error')
}
stream.on('data', data => {})
stream.on('end', ()={
  console.log('end')
}

I can see both 'error' and 'end' handlers are called.


Node: v16.14.2 grpc-js: 1.8.11

asakiasako avatar Feb 28 '23 09:02 asakiasako