-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service Client generated doesn't support Promise response #243
Comments
To add to this, There is an old issue in the tracker as #59 which is stated that it will not be fixed. Mainly because willingness not to break compatibility with official node. And, Since recently official client added support for So would it be possible to reconsider #59 and possibly provide something similar here? Thank you, |
+1 |
Adding another +1 here; promises would be much, much nicer |
+1 The problem faced: Was trying to convert a grpc binding method that had a callback into a promise using This issue is talked about in further detail here: microsoft/TypeScript#26048 Solution I am following right now as a substitute is to manually construct promises like done here: https://medium.com/expedia-group-tech/the-weird-world-of-grpc-tooling-for-node-js-part-3-d994de02bedc#a-dynamic-client OR here: https://stackoverflow.com/questions/62220154/gprc-client-async-response-nodejs. |
+1. We've got quite complicated logic and currently, there's a choice between callback hell and much more complicated logic spread between a number of functions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
It's still relevant. |
So what is the current approach? For every generated method make a wrapper? |
this is really a problem, any progress? |
grpc-web implements a pretty good Promise-based client: grpc_generator.cc#L742 edit: to clarify, just as a point of reference. It uses |
The generated service client doesn't give a Promise response, instead, it requires callbacks for handling the response from the server.
Versions of relevant software used
latest
What happened
This is a sample generated client code. https://github.com/improbable-eng/ts-protoc-gen/blob/master/examples/generated-grpc-web/proto/examplecom/simple_service_pb_service.d.ts
From the types you can see the when you execute a generated client, you need to pass the request object and a callback as a second parameter to handle the response.
What you expected to happen
Expects that when you execute a service client, it give a promise response instead
The text was updated successfully, but these errors were encountered: