bug: del upstream but not del route, request the route, return 500
- Why do you submit this issue?
- [ ] Question or discussion
- [x] Bug
- [ ] Requirements
- [ ] Feature or performance improvement
- [ ] Other
Bug
- Which version of Apache APISIX Dashboard, OS, and Browser? APISIX 2.0 + APISIX-dashbaord 2.0
step1: create upstream step2: create route, and chose upstream created by step1 step3: del the step1's upstream from dashboard's upstream page step4: request the route, return 500
I think step3 should be limited.
that is a bug we know already, we can fix it later
for this issue, we should print a friendly error message, help the user to know the reason
@membphis it's the same bug I found by e2e test
ok, got it. we can fix it in 2.1, low priority
here is test case
{
caseDesc: "delete upstream - being used by route 1",
Object: MangerApiExpect(t),
Method: http.MethodDelete,
Path: "/apisix/admin/upstreams/1",
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusBadRequest,
},
Here is an example, the APISIX will return 500 if failed to load the upstream by id upstream_id, and will generate a error log.
curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"plugins": {
"limit-count": {
"count": 2,
"time_window": 60,
"rejected_code": 503,
"key": "remote_addr"
}
},
"upstream_id": "no_exist_id"
}'
For this case, the APISIX can return 502 and write a WARN error log, should be enough
@spacewander what do you think?
Yes, for DP, return 502 is enough.