apisix icon indicating copy to clipboard operation
apisix copied to clipboard

request help: how to use batch-requests plugin

Open idbeta opened this issue 6 years ago • 6 comments

Issue description

I want to try batch-requests, but when I testing it according to the method in the document, always returned an error, it is different from the result in the document. Is there a mistake in my operation? @ShiningRush

Environment

  • apisix version (cmd: apisix version): master
  • OS: macos
curl --location --request POST 'http://127.0.0.1:9080/apisix/batch-requests' \
--header 'Content-Type: application/json' \
--data '{
    "headers": {
        "Content-Type": "application/json",
        "admin-jwt":"xxxx"
    },
    "timeout": 500,
    "pipeline": [
        {
            "method": "POST",
            "path": "/community.GiftSrv/GetGifts",
            "body": "test"
        },
        {
            "method": "POST",
            "path": "/community.GiftSrv/GetGifts",
            "body": "test2"
        }
    ]
}'

return

[
    {
        "body":"{"error_msg":"404 Route Not Found"}
",
        "reason":"Not Found",
        "status":404,
        "headers":{
            "Connection":"keep-alive",
            "Content-Type":"text/plain; charset=utf-8",
            "Date":"Fri, 13 Nov 2020 03:38:34 GMT",
            "Server":"APISIX/2.0",
            "Transfer-Encoding":"chunked"
        }
    },
    {
        "body":"{"error_msg":"404 Route Not Found"}
",
        "reason":"Not Found",
        "status":404,
        "headers":{
            "Connection":"keep-alive",
            "Content-Type":"text/plain; charset=utf-8",
            "Date":"Fri, 13 Nov 2020 03:38:34 GMT",
            "Server":"APISIX/2.0",
            "Transfer-Encoding":"chunked"
        }
    }
]

idbeta avatar Nov 13 '20 03:11 idbeta

ping @idbeta

moonming avatar Jan 25 '21 15:01 moonming

"path": "/community.GiftSrv/GetGifts",

Hmmm, this route is not default,it would be better to change it to a default route.

ShiningRush avatar Jan 25 '21 15:01 ShiningRush

"path": "/community.GiftSrv/GetGifts",

Hmmm, this route is not default,it would be better to change it to a default route.

ok, I will give it a try.

idbeta avatar Jan 26 '21 02:01 idbeta

I know how to use this plugin, thanks. I think you should add some description in the doc, like "a route should be created first, then use the batch-requests plugin to access this route for requests". @ShiningRush

idbeta avatar Jan 26 '21 05:01 idbeta

i am already have same problem and cannot use this plugins functionality. note that i added new route but not working and always give me 404 error

ebrahimghane avatar Aug 22 '23 23:08 ebrahimghane

i am already have same problem and cannot use this plugins functionality. note that i added new route but not working and always give me 404 error

i found root of my problem . the batch-requests plugin isn't enabled by default ! why?!!!

and now i have new problems: when i enable plugins in config.yaml another plugins will be disabled! when i enable all plugins i give 504 error continuously. the batch-requests plugin only response on first pipeline path and other pipeline paths give me status 504, "reason": "upstream timeout" . but i increased timeout

ebrahimghane avatar Aug 23 '23 12:08 ebrahimghane