Comments (12)
Ok I dug into this and got it working if I change the content type to application/grpc
from application/grpc+proto
which doesn't make much sense. I will dig in a bit more into this...
from tonic.
@Hirevo just for more debugging purposes by chance could you see what the headers are that gcp returns to you?
So I know we don't quite yet support compression but I am curious if we can disable it.
from tonic.
And also since you have an interceptor does changing it to this work?
.intercept_headers(|headers| {
let token = "some-valid-google-oauth-token";
let value = format!("Bearer {0}", token);
let value = HeaderValue::from_str(value.as_str()).unwrap();
headers.insert("authorization", value);
headers.insert("grpc-accept-encoding", HeaderValue::from_str("identity").unwrap());
})
The docs are not clear specifically if this will work but pretty much for now we need to tell their grpc server that we don't accept any compression.
from tonic.
@LucioFranco Yes, here are the response headers that the Go code received for the gRPC call:
metadata.MD{
"alt-svc":[]string{
"quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000"
},
"content-disposition":[]string{"attachment"},
"content-type":[]string{"application/grpc"},
"date":[]string{"Mon, 28 Oct 2019 21:12:24 GMT"}
}
I have also just tried the additional header you proposed, but the error has not changed, sadly.
Also, I published both the Rust and Go versions of these tests, with the same setup and crate versions that I have:
Rust: https://github.com/Hirevo/rust-gcp-test
Go: https://github.com/Hirevo/go-gcp-test
from tonic.
from tonic.
@peter05010402 what version of tonic are you using?
from tonic.
I also had the same Error when using grpc steram rpc. It doesn't have the error at program startup but occurs at many minutes after. Then I re-connect to the grpc server and the error is gone but many minutes it will come again.
The server side is golang. And I tried tonic 0.2 and 0.3.1, not change anything.
from tonic.
@frostRed you are getting the "unexpected compression flag error" after startup? Usually this only happens when you have an incorrectly configured channel. value 60 for this flag isn't even valid iirc.
from tonic.
No, after startup everything is ok, it only occurs on after running half hour or longer.
from tonic.
Not startup for the process but for the connection? If that is still the issue something that can reproduce this or that we can inspect the frames would be very helpful.
from tonic.
I arrived here googling "invalid compression flag: 60" and found out that I get a similar error message if I use the wrong endpoint URL e.g. using pubsub URL for endpoint with firestore client.
Its a stupid mistake while copy pasting from gcp example but error message is a little cryptic.
const ENDPOINT: &str = "https://pubsub.googleapis.com"; // wrong endpoint
let token = "some valid token";
let token_metadata: MetadataValue<_> = format!("Bearer {}", token).parse().unwrap();
let channel = Channel::from_static(ENDPOINT)
.connect()
.await.unwrap();
let mut client = FirestoreClient::with_interceptor(channel, move |mut req: Request<()>| {
req.metadata_mut()
.insert("authorization", token_metadata.clone());
Ok(req)
});
// ...
Response struct I get if I call client.create_document(...)
:
Status {
code:
Internal,
message: "protocol error: received message with invalid compression flag: 60 (valid flags are 0 and 1) while receiving response with status: 404 Not Found",
metadata: MetadataMap{
headers: {
"date": "Sun, 24 Jul 2022 14:57:20 GMT",
"content-type": "text/html; charset=UTF-8",
"server": "ESF",
"content-length": "1605",
"x-xss-protection": "0",
"x-frame-options": "SAMEORIGIN",
"x-content-type-options": "nosniff",
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
}
},
source: None
}
from tonic.
This is because google's api is talking http3 and not http2. There could be a few reasons but maybe the way alpn is negotated is't working. Not totally sure what they changed and maybe the example doesn't work anymore?
from tonic.
Related Issues (20)
- Introduce a build option to not add `#[async_trait]` on generated service.
- BrokenPipe Error Using TLS With Root Certificate
- Received Status.source = None when server sends Status.source = Some
- Use a `Sink` argument instead of returning a `Stream` for response streaming
- Limit of 4M on outgoing messages HOT 3
- Malformed response for non `Ok` statuses when using `web_tonic` on the server.
- Dynamically named services
- Bump hyper / http / http-body to 1.x version HOT 2
- Integration of flatbuffers
- gRPC-web CORS issue HOT 1
- Add a way to test/inspect server and router build/configuration
- GOAWAY message leads to other Clients/Channels being unresponsive
- `tonic-reflection` is still using deprecated file descriptor set reflection_v1alpha1 HOT 1
- tonic-build: Codegen generates a name collision after auto-capitalization is applied, resulting in cargo build errors HOT 1
- `tonic-health`: add `NOT_SERVING` override for all registered services
- Idiomatic import paths
- IPv6 endpoint passed through the URL will crash
- Async Interceptor support HOT 2
- How to create channel without tls when tls feature flag is enabled HOT 1
- Response::new does not send grpc-status code correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tonic.