Closed pro-wh closed 1 year ago
oh oops this should skip if deserializing failed. I'll add some logic to do that
added
there are more changes needed in thenableCall
Hi! Thanks for the contribution and sorry for the delay!
2 quick questions:
thanks!
Hi, thanks for helping out with this.
We haven't been using .proto files to define the methods, so we construct a bunch of our own MethodDescriptor
objects. Thus all it took for us was to pass the https://github.com/grpc/grpc-web/blob/1.3.1/javascript/net/grpc/web/methoddescriptor.js#L33 responseDeserializerFn
Ya let me try adding one
How to use a custom codec:
We haven't been using .proto files to define the methods, so we construct a bunch of our own
MethodDescriptor
objects. Thus all it took for us was to pass the https://github.com/grpc/grpc-web/blob/1.3.1/javascript/net/grpc/web/methoddescriptor.js#L33responseDeserializerFn
Oh aha! Intersting! Thanks for the info! I guess that's one way of using the library (but without the codegen) 😃
I wonder if we mention the use of library in this way on any documentation? Or this is just one creative way you found out about using it? (I'm guess in the latter case I'm not sure if such use will be "officially supported" going forward, even if we could probably fix a few non-harming edge-cases right now) 😃
Adding a test
Ya let me try adding one
thanks!!
- https://github.com/grpc/grpc-web/blob/1.3.1/packages/grpc-web/index.d.ts#L77 it's publicly listed in this manually written type declaration
- https://github.com/grpc/grpc-go/blob/master/Documentation/encoding.md#codecs-serialization-and-deserialization custom codecs are a normal part of grpc
Ah thanks for the info!
I did a quick search and found that the majority of mentioning for custom codec is for golang. (there are some mentions on other languages but nothing seems officially documented.) So personally i'd still consider this a borderline edge use case :) Happy to take small patches if it's easy to maintain, but probably no commitment for major feature support going forward :)
aaah I just saw the new release and realized this was still pending
So personally i'd still consider this a borderline edge use case :) Happy to take small patches if it's easy to maintain, but probably no commitment for major feature support going forward :)
we're happy with that too. if you could please review :pray:
aaah I just saw the new release and realized this was still pending
aha right i've forgot as well :)
So personally i'd still consider this a borderline edge use case :) Happy to take small patches if it's easy to maintain, but probably no commitment for major feature support going forward :)
we're happy with that too. if you could please review 🙏
thanks for your interest here! On a 2nd thought, I'll need to check with the team on our stance on custom codec before getting back at you. Thanks!
Sounds good, thanks for checking with the team
Of course!
Oh and actually, since you'll be depending on MethodDescriptor
, i guess this will be related to https://github.com/grpc/grpc-web/issues/1285 -- where we're no longer exposing its API due to internal code size issue (PR here).
But we could explore our options there too..
In the meanwhile, maybe you could rebase your code onto 1.4.0 and see if it breaks you?
Thanks!
interesting, thanks for the heads up. let me experiment with the changes in 1.4.0. if it's only from the typescript headers, we should be fine
update: yes, it does break our .getName
callsite. we will be switching back to .name
when we upgrade to 1.4.0
update: yes, it does break our
.getName
callsite. we will be switching back to.name
when we upgrade to 1.4.0
aha interesting thanks for confirming! So i guess that would work but is somewhat a "hack".. :)
I'm getting this when I try to run the tests
[16:40:38] I/update - chromedriver: file exists /home/wh0/work/ekiden/grpc-web/packages/grpc-web/node_modules/webdriver-manager/selenium/chromedriver_93.0.4577.63.zip [16:40:38] I/update - chromedriver: unzipping chromedriver_93.0.4577.63.zip [16:40:38] I/update - chromedriver: setting permissions to 0755 for /home/wh0/work/ekiden/grpc-web/packages/grpc-web/node_modules/webdriver-manager/selenium/chromedriver_93.0.4577.63 [16:40:38] I/update - chromedriver: chromedriver_93.0.4577.63 up to date [16:40:38] I/update - selenium standalone: file exists /home/wh0/work/ekiden/grpc-web/packages/grpc-web/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar [16:40:38] I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date [16:40:54] I/launcher - Running 1 instances of WebDriver [16:40:54] I/direct - Using ChromeDriver directly... [16:40:54] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 93 Current browser version is 106.0.5249.119 with binary path /usr/bin/google-chrome
is it erroneously using my systemwide chrome rather than its own version for testing?
I'm getting this when I try to run the tests
[16:40:38] I/update - chromedriver: file exists /home/wh0/work/ekiden/grpc-web/packages/grpc-web/node_modules/webdriver-manager/selenium/chromedriver_93.0.4577.63.zip [16:40:38] I/update - chromedriver: unzipping chromedriver_93.0.4577.63.zip [16:40:38] I/update - chromedriver: setting permissions to 0755 for /home/wh0/work/ekiden/grpc-web/packages/grpc-web/node_modules/webdriver-manager/selenium/chromedriver_93.0.4577.63 [16:40:38] I/update - chromedriver: chromedriver_93.0.4577.63 up to date [16:40:38] I/update - selenium standalone: file exists /home/wh0/work/ekiden/grpc-web/packages/grpc-web/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar [16:40:38] I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date [16:40:54] I/launcher - Running 1 instances of WebDriver [16:40:54] I/direct - Using ChromeDriver directly... [16:40:54] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 93 Current browser version is 106.0.5249.119 with binary path /usr/bin/google-chrome
is it erroneously using my systemwide chrome rather than its own version for testing?
Aha not sure.. i forgot how i setup my chrome driver.. maybe 93 is a bit too old i can update it soon.. (although i'm using 106.0.5249.119
too and it seems to work..)
Although, if you run the test using ./scripts/run_basic_tests.sh
then it'll use docker and will probably work.
Could you try that and see if it works? Thanks :)
I will cut a new release soon (prob. later this week) with this change. Thanks again! 😃
FYI a new release with this change is cut here :)
cross reference https://github.com/grpc/grpc-web/pull/1025
When using a different codec where primitive values are allowed (we use CBOR), the current implementation omits calling the
data
listeners on falsy values, such as0
andnull
. But we'd like to have them.Is there anything else that relies on the current behavior that omits these values?
Discussion of changes in
GrpcWebClientBase
:Current implementation uses
setCallback_
in a special "useUnaryResponse" mode. In this mode, additional calls are made to the callback withstatus
andmetadata
parameters, then a final time with botherror
andresponse
set tonull
.In order to support falsy and even null message, this changes the final callback call to pass
true
to a new explicittrigger
parameter.callback(null, null)
now means "no error, and the response was null" (and similar for other falsy responses).setCallback_
is private, and the only public wrapper does not allow the "useUnaryResponse" mode, so it should be safe to make this change.