Open frederikhors opened 3 years ago
Here is the code for that middleware: https://github.com/volatiletech/authboss/blob/master/client_state.go#L123.
Sounds like some sort of timeout is being hit. I don't know why the middleware is causing the server to wait, I can't see it doing anything suspicious with the request body at a first glance. I'd probably just try and debug it more!
authboss's author, @aarondl, answered this here:
The response is always closed, it's a guarantee by the stdlib nowadays. Now because you're using grpc in some fashion that might be different maybe they're doing their own weird http things.
Authboss's middleware is pretty simple, when a request comes in it gives the request to LoadClientState which gives it to your
ClientStateReadWriter
to extract client state variables out. It collects session and cookie changes in memory and when someone calls WriteHeader or Write it will flush those out to the response. In essence that's how it works. I'm not sure exactly where things are going wrong here because there's quite a few layers.But I'd suggest reading client_state.go and take a look at the
ClientStateResponseWriter
which is likely the trouble spot. Notably calls to hijack() will fail completely and if they're using hijack that might be a problem?
Are you using hijack
here?
Most of the logic is in this file: https://github.com/improbable-eng/grpc-web/blob/master/go/grpcweb/wrapper.go. We're doing some wrapping of the body, but I don't think we're using Hijack, unless you're using websockets and it's done by our websocket library.
unless you're using websockets and it's done by our websocket library
Nope.
Versions of relevant software used
github.com/improbable-eng/grpc-web v0.14.0
What happened
I have been using
grpc-web
for a long time (it's such a pleasure, THANKS!).I'm using it with authboss too.
Today I had to test the gRPC server streaming and after HOURS of trying I found a strange issue described below:
I'm trying to use
protobuf-ts
but I don't get messages from server until connection is closed.I'm using Svelte 3 like this:
The call in in pending state for about 2.2 min. After that I get all messages logged in console.
If I change this line:
to:
(removing
authb.LoadClientStateMiddleware
) it works!Why?
Can you suggest me something?