You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/04 10:16:02 UTC

[GitHub] [apisix] ameryhan opened a new issue #6005: bug: getkey获取etcd里的某个目录失败

ameryhan opened a new issue #6005:
URL: https://github.com/apache/apisix/issues/6005


   ### Issue description
   
   getkey获取etcd里的某个目录失败
   
   尝试过的方法1
     local res, err = core.etcd:getkey('/config_path')
    报错信息如下
   ![image](https://user-images.githubusercontent.com/2375525/148041696-0583dee7-b927-4851-99eb-0cc4c75c08cb.png)
   
   尝试过的方法2
     local res, err = core.config:getkey('/config_path')
   返回的数据为空。
   
   ### Environment
   
   - apisix version (cmd: `apisix version`): 2.10.2
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] The-White-Lion commented on issue #6005: bug: getkey获取etcd里的某个目录失败

Posted by GitBox <gi...@apache.org>.
The-White-Lion commented on issue #6005:
URL: https://github.com/apache/apisix/issues/6005#issuecomment-1004771933


   It's not a bug.
   In the first method you tried, a non-existent function `core.etcd:getkey`  was used. You can read the [source code ](https://github.com/apache/apisix/blob/master/apisix/core/etcd.lua) to see the supported functinos. In this case, You can use function `core.etcd.get(key, true)` ( use dot instaed of colons) to get data.
   In the second method you tried, before you call `core.confing:getkey()` function, you shuold call the function `core.config.new()`. 
   Otherwise, you will exit in here https://github.com/apache/apisix/blob/d3bb8f9035b14b35e2d2eccd0959ed00e8fe88e3/apisix/core/config_etcd.lua#L488.
   
   Note: Make sure that what is stored under this key is not an object.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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