We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Following proto schema
rpc GetTime(google.protobuf.Empty) returns (google.protobuf.Timestamp);
generates following client code with outputServices=grpc-js
outputServices=grpc-js
getTime(request: Empty, callback: (error: ServiceError | null, response: Date) => void): ClientUnaryCall;
But actual response type is Timestamp, not Date
client.getTime({}, (error, response) => { console.log(response) // { seconds: 1672938038, nanos: 388586128 } })
It seems the generated service code for deserialization is incorrect.
getTime: { path: "/namespace.Service/GetTime", requestStream: false, responseStream: false, requestSerialize: (value: Empty) => Buffer.from(Empty.encode(value).finish()), requestDeserialize: (value: Buffer) => Empty.decode(value), responseSerialize: (value: Date) => Buffer.from(Timestamp.encode(toTimestamp(value)).finish()), responseDeserialize: (value: Buffer) => Timestamp.decode(value), // <- should be wrapped by fromTimestamp() },
Also useDate=false doesn't generate valid code for serialization.
useDate=false
responseSerialize: (value: Date) => Buffer.from(Timestamp.encode(toTimestamp(value)).finish()), // correct
responseSerialize: (value: string) => Buffer.from(Timestamp.encode(toTimestamp(value)).finish()), // correct
responseSerialize: (value: Timestamp) => Buffer.from(Timestamp.encode(toTimestamp(value)).finish()), // compile error: shouldn't be wrapped by toTimestamp()
I'll open a PR to fix them.
The text was updated successfully, but these errors were encountered:
fix: stephenh#754 timestamp conversion for grpc-js
129174c
fix: grpc-js timestamp conversion (#755)
9d24bd3
* fix: #754 timestamp conversion for grpc-js * test: timestamp conversion for grpc-js
chore(release): 1.137.1 [skip ci]
024cac5
## [1.137.1](v1.137.0...v1.137.1) (2023-01-07) ### Bug Fixes * grpc-js timestamp conversion ([#755](#755)) ([9d24bd3](9d24bd3)), closes [#754](#754)
🎉 This issue has been resolved in version 1.137.1 🎉
The release is available on:
v1.137.1
Your semantic-release bot 📦🚀
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Following proto schema
generates following client code with
outputServices=grpc-js
But actual response type is Timestamp, not Date
It seems the generated service code for deserialization is incorrect.
Also
useDate=false
doesn't generate valid code for serialization.I'll open a PR to fix them.
The text was updated successfully, but these errors were encountered: