gRPC streaming not flushing

We have an API for a gRPC backend service that provides a server streaming operation, connected via h2c. Streaming works in general, but not as designed, since individual responses in the stream are not flushed toward the client. When the backend service finishes, all responses are provided to the client at once.
This renders the streaming feature useless, as the events would usually not end before the client times out when not receiving any data.

We have the following relevant settings enabled:

  • TYK_GW_HTTPSERVEROPTIONS_FLUSHINTERVAL = 1
  • TYK_GW_HTTPSERVEROPTIONS_ENABLEHTTP2 = true
  • TYK_GW_PROXYENABLEHTTP2 = 'true`

Does someone have a working setup for such a streaming API? We don’t have a clou what else to check to make this work :disappointed:

1 Like

I found the main issue for the problem. If OpenTelemetry is enabled, the responseWriter is no longer a http.Flusher, and therefore flushing does not work.
Disabling OpenTelemetry “fixes” the problem, but I guess there should be a code change required to make it work also with tracing enabled.

Great troubleshooting and congratulations on self-solving the issue. I was going to look into the issue today since I remember having this working without any issues in the past—so great job :+1:.

Could you share the version of the gateway you used? I’m going to check this and open a bug request internally.

We’re running v5.2.5