tzssangglass commented on issue #4143:
URL: https://github.com/apache/apisix/issues/4143#issuecomment-828174543


   I verified
   
   step 1:  use etcdctl add user apisix and grant all privilege on /apisix/*
   
   command like
   ```shell
   etcdctl --endpoints=http://127.0.0.1:2379 user add apisix
   
   etcdctl --endpoints=http://127.0.0.1:2379 role add apisix
   
   etcdctl --endpoints=http://127.0.0.1:2379 user grant-role apisix apisix
   
   etcdctl --endpoints=http://127.0.0.1:2379 role grant-permission apisix 
--prefix=true readwrite /apisix/
   
   etcdctl --endpoints=http://127.0.0.1:2379 auth enable
   ```
   
   step 2: edit apisix/conf/config.yaml, add the user to apisix
   
   the config.yaml like 
   
   ```yaml
   etcd:
     host:
       - "http://127.0.0.1:2379";
     prefix: "/apisix"
     user: apisix
     password: abc123
   ```
   
   step 3: curl metrics
   
   command like 
   
   ```shell
   http://127.0.0.1:9080/apisix/prometheus/metrics
   ```
   
   
   step 4: error.log
   
   I get the error.log like
   
   ```nginx
   2021/04/28 14:00:16 [error] 57379#1168662: *12753 [lua] http.lua:913: 
request_uri(): unread data in buffer, client: ::1, server: , request: "GET 
/apisix/prometheus/metrics HTTP/1.1", host: "localhost:9080"
   2021/04/28 14:00:16 [error] 57379#1168662: *12753 lua entry thread aborted: 
runtime error: /usr/local/Cellar/apisix/apisix/core/etcd.lua:92: attempt to 
index field 'header' (a nil value)
   stack traceback:
   coroutine 0:
        /usr/local/Cellar/apisix/apisix/core/etcd.lua: in function 'get_format'
        /usr/local/Cellar/apisix/apisix/core/config_etcd.lua:75: in function 
'getkey'
        ...cal/Cellar/apisix/apisix/plugins/prometheus/exporter.lua:310: in 
function 'handler'
        /usr/local/Cellar/apisix/apisix/api_router.lua:130: in function 
'handler'
        ...al/Cellar/apisix//deps/share/lua/5.1/resty/radixtree.lua:720: in 
function 'dispatch'
        /usr/local/Cellar/apisix/apisix/api_router.lua:165: in function 'match'
        /usr/local/Cellar/apisix/apisix/init.lua:292: in function 
'http_access_phase'
        access_by_lua(nginx.conf:209):2: in main chunk, client: ::1, server: , 
request: "GET /apisix/prometheus/metrics HTTP/1.1", host: "localhost:9080"
   
   
   ```
   
   by the way, when I switched to apisix 2.5, I got a similar error starting 
apisix, which seems to be a problem with apisix and etcd interaction.


-- 
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:
[email protected]


Reply via email to