krakend / krakend-ce

KrakenD Community Edition: High-performance, stateless, declarative, API Gateway written in Go.
https://www.krakend.io
Apache License 2.0
1.94k stars 453 forks source link

KrakenD returns empty response for collection endpoint #835

Closed akvasof closed 9 months ago

akvasof commented 9 months ago

I have the backend returns next json collection response in Postman:

image

then I have next config:

        {
           "endpoint": "/products",
           "method": "GET",
           "output_encoding": "json-collection",
          "input_headers": ["*"]

           "backend":  
                {
                  "url_pattern": "/api/products?status=5",
                  "method": "GET",
                  "encoding": "<no value>",
                     "is_collection": "true", 
                  "host": "https://...",
                  "extra_config": {
                        "backend/http": {
                          "return_error_code": true
                        }

                            ,"proxy": {"flatmap_filter":[{"args":["productGroups"],"type":"del"}]}

                    }
                }
        }

and this endpoint always returns empty result:

image

Could someone explain what I'm doing wrong?

I spent lot of time to read docs and google and play with different parameters but without luck. If I use "output_encoding": "no-op" everything work fine, but then ,"proxy": {"flatmap_filter":[{"args":["productGroups"],"type":"del"}]} doesn't work as per design.

Service config part is:

{
    "port": 4000,
    "name": "KrakenD development",
    "environment": "DEVELOPMENT",
    "default_host": "http://localhost:4000",
    "timeout": "2000s",
    "cache_ttl": "3s",
    "debug_endpoint": true,
    "echo_endpoint": true,
    "plugin": {
      "pattern": ".so",
      "folder": "/opt/krakend/plugins/"
    },

    "extra_config": {
      "telemetry/logging": {
        "level": "DEBUG",
        "prefix": "[KRAKEND]",
        "syslog": false,
        "stdout": true
      },
      "router": {
        "return_error_msg": true
      },
      "telemetry/metrics": {
          "collection_time": "60s",
          "proxy_disabled": false,
          "router_disabled": false,
          "backend_disabled": false,
          "endpoint_disabled": false,
          "listen_address": ":8090"
      }
    }
 }
github-actions[bot] commented 6 months ago

This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.