krakend-ce icon indicating copy to clipboard operation
krakend-ce copied to clipboard

Issue while streaming data from backend

Open Arvi89 opened this issue 5 months ago • 1 comments

Environment info:

  • KrakenD version: 2.7.1
  • System info: podman version 5.2.1
  • Hardware specs: 16GB Ram, 8 core CPU
  • Backend technology: Go
  • Additional environment information:

Describe the bug So I have a service that returns streamed data through a SSE. While passing it through krakend, we use the no-op, however we have an issue: instead of sending chunks of data as they arrive, the gateway wait then sends by bulk (which is not what we want)

Your configuration file: This is a simplified file

{
  "$schema": "https://www.krakend.io/schema/krakend.json",
  "version": 3,
  "client_tls": {
    "@comment": "Skip SSL verification when connecting to backends",
    "allow_insecure_connections": true
  },
  "name": "KrakenD - API Gateway",
  "extra_config": {
    "security/http": {
      "allowed_hosts": [],
      "ssl_proxy_headers": {}
    }
  },
  "timeout": "100s",
  "disable-compression": true,
  "cache_ttl": "300s",
  "output_encoding": "no-op",
  "endpoints": [
    {
      "endpoint": "/threads",
      "method": "POST",
      "output_encoding": "no-op",
      "backend": [
        {
          "url_pattern": "/threads",
          "encoding": "no-op",
          "sd": "static",
          "method": "POST",
          "host": [
            "https://service.consul"
          ],
          "disable_host_sanitize": false
        }
      ],
      "input_headers": [
        "*"
      ]
    }
  ]
}

Expected behavior I want the data to be returned as soon as it arrives, and not wait to send a bulk.

Basically it's a problem similar as this one: https://support.konghq.com/support/s/article/How-can-I-enable-streaming-of-responses-with-text-event-stream-content-types-instead-of-having-the-responses-buffered-and-sent-in-one-large-payload

Arvi89 avatar Sep 11 '24 13:09 Arvi89