spacewander commented on issue #3266:
URL: https://github.com/apache/apisix/issues/3266#issuecomment-759907291


   I guess it is caused by some response which doesn't contain `header` field 
in its body.
   You can take your investigation from:
   
https://github.com/api7/lua-resty-etcd/blob/f2abd8b99629c1c8b133aa25e6c7c20a255d0d4a/lib/resty/etcd/v3.lua#L90
   You can search corresponding response or just dump them out.
   
   The patch below may help you catch those response:
   ```diff
   diff --git apisix/core/etcd.lua apisix/core/etcd.lua
   index 07af2b06..a26b4958 100644
   --- apisix/core/etcd.lua
   +++ apisix/core/etcd.lua
   @@ -89,6 +89,9 @@ function _M.get_format(res, real_key, is_dir)
            return nil, "insufficient credentials code: 401"
        end
   
   +    if not res.body.header then
   +        local cjson = require("cjson.safe"); ngx.log(ngx.ALERT, "", 
cjson.encode(res.body))
   +    end
        res.headers["X-Etcd-Index"] = res.body.header.revision
   
        if not res.body.kvs then
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to