krakend / krakend-ce

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

"Too many output params!" in sequential setting with POST request. #93

Closed Michael2008S closed 5 years ago

Michael2008S commented 5 years ago

This is my config:

{
  "version": 2,
  "name": "My lovely gateway",
  "port": 8008,
  "cache_ttl": "3600s",
  "timeout": "3s",
  "extra_config": {
    "github_com/devopsfaith/krakend-gologging": {
      "level": "DEBUG",
      "prefix": "[KRAKEND-sequential]",
      "syslog": false,
      "stdout": true
    }
  },
  "endpoints": [
    {
      "endpoint": "/gcapi/pmall.goods.Goods_backStage/ViewById",
      "headers_to_pass": [
        "*"
      ],
      "output_encoding": "json",
      "method": "POST",
      "backend": [
        {
          "url_pattern": "/gcrpc/pmall.goods.Goods_backStage/ViewById",
          "encoding": "no-op",
          "host": [
            "http://127.0.0.1:61020"
          ]
        },
        {
          "url_pattern": "/gcrpc/pmall.category.Category_backstage/ViewById/{{resp0_category_id}}",
          "encoding": "no-op",
          "host": [
            "http://127.0.0.1:61020"
          ]
        }
      ],
      "extra_config": {
        "github.com/devopsfaith/krakend/proxy": {
          "sequential": true
        }
      }
    }
  ]
}

go run cmd/krakend-ce/main.go check -d -c ./krakend_proxy.json

get this error:

Parsing configuration file: ./krakend_proxy.json
Parsed configuration: CacheTTL: 1h0m0s, Port: 8008
Hosts: []
Extra (1):
  github_com/devopsfaith/krakend-gologging: map[stdout:true level:DEBUG syslog:false prefix:[KRAKEND-sequential]]
Endpoints (1):
        Endpoint: /gcapi/pmall.goods.Goods_backStage/ViewById, Method: POST, CacheTTL: 1h0m0s, Concurrent: 1, QueryString: []
        Extra (1):
          github.com/devopsfaith/krakend/proxy: map[sequential:true]
        Backends (2):
                URL: /gcrpc/pmall.goods.Goods_backStage/ViewById, Method: POST
                        Timeout: 3s, Target: , Mapping: map[], BL: [], WL: [], Group: 
                        Hosts: [http://127.0.0.1:61020]
                        Extra (0):
                URL: /gcrpc/pmall.category.Category_backstage/ViewById/{{resp0_category_id}}, Method: POST
                        Timeout: 3s, Target: , Mapping: map[], BL: [], WL: [], Group: 
                        Hosts: [http://127.0.0.1:61020]
                        Extra (0):
ERROR parsing the configuration file.
 Too many output params! input: map[resp0_category_id:<nil>], output: [resp0_category_id]
Michael2008S commented 5 years ago

BTW: The two request is:

  curl -X "POST" "http://localhost:61020/gcrpc/pmall.category.Category_backstage/ViewById" \
>      -H 'Content-Type: application/json; charset=utf-8' \
>      -d $'{
quote>   "id": "1"
quote> }'
{"data":{"id":"1","parent_cid":"0","icon_url":"url","name":"2a2a","desc":"desc","level":"0","created_at":"2019-02-19T09:36:46.616248Z","updated_at":"2019-02-20T08:39:05.448014Z","deleted_at":null}}%     
 curl -X "POST" "http://localhost:61020/gcrpc/pmall.goods.Goods_backstage/ViewById" \     
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "id": "1"
}'
{"data":{"id":"1","name":"商品名称","detail":"商品详情","desc":"商品描述","price":100,"origin_price":100,"main_img":"","pics":[],"redeem_score":"15000","category_id":"1","category":{"@googleapis.com/pmall.category.CategoryItem","id":"1","parent_cid":"0","icon_url":"url","name":"2a2a","desc":"desc","level":"0","created_at":"2019-02-19T09:36:46.616248Z","updated_at":"2019-02-20T08:39:05.448014Z","deleted_at":null},"origin":"","stock":"111","created_at":"2019-03-01T03:05:48.753329Z","updated_at":"0001-01-01T00:00:00Z","deleted_at":null,"is_collect":false}}%   
kpacha commented 5 years ago

please, check my comment on this issue: https://github.com/devopsfaith/krakend/issues/194#issuecomment-460470842

Michael2008S commented 5 years ago

@kpacha I use the https://github.com/twitchtv/twirp framework to generate code as my backend service. And It only generate the POST request .So maybe I should change the code by myself 😂.

github-actions[bot] commented 2 years 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.