grpc / grpc/grpc-node

grpc-js: end event emitted on client streaming errors

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

Description

### Problem description
If an uncaught error occurs in the data handler the end handler is still fired. I'm not sure if this is intentional but based on the standard node.js readable stream I would expect this not to be called.

In this scenario because the callback is already handled [here](https://github.com/grpc/grpc-node/blob/%40grpc/grpc-js%401.0.3/packages/grpc-js/src/server.ts#L644) you cannot subscribe to the error event to handle the error and send a response.
```
clientStreamExample(call, callback) {
call.on('data', () => {
throw new Error('my error');
});

call.on('end', () => {
console.log('ended');
callback(null, {});
});
}
```

### Environment
- OS name, version and architecture: macOS 10.15.4
- Node version: v12.16.2
- Package name and version @grpc/grpc-js@1.0.3

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.