xyz2b opened a new issue #4370:
URL: https://github.com/apache/apisix/issues/4370
### Issue description
An error is reported when the configuration is updated from etcd regularly.
Apisix create a timer in the init phase to update the configuration from
etcd, but the `lua_ssl_trusted_certificate` configuration is configured in the
server configuration block. The scope of `init_by_lua_block` is the http
configuration block, So the `lua_ssl_trusted_certificate` configuration of
apisix is invalid in the http configuration block.
I moved the configuration from the server configuration block to the http
configuration block and solved it.
error.log
```shell
2021/06/03 15:46:39 [error] 22427#22427: *57 [lua] config_etcd.lua:551:
failed to fetch data from etcd: 20: unable to get local issuer certificate,
etcd key: /apisix/routes, context: ngx.timer
2021/06/03 15:46:39 [error] 22429#22429: *32 [lua] config_etcd.lua:551:
failed to fetch data from etcd: 20: unable to get local issuer certificate,
etcd key: /apisix/routes, context: ngx.timer
```
### Environment
Request help without environment information will be ignored or closed.
* apisix version (cmd: `apisix version`):
```shell
[app@VM_97_180_centos apisix]$ ./bin/apisix version
/data/app/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua version
2.6
```
* OS (cmd: `uname -a`):
```shell
[app@VM_97_180_centos apisix]$ uname -a
Linux VM_97_180_centos 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23
15:46:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
```
* OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
```shell
[app@VM_97_180_centos apisix]$ openresty -V
nginx version: openresty/1.19.3.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.1.1k 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/data/app/openresty/nginx --with-debug
--with-cc-opt='-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -O2'
--add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62
--add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2
--add-module=../set-misc-nginx-module-0.32
--add-module=../form-input-nginx-module-0.12
--add-module=../encrypted-session-nginx-module-0.08
--add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.19
--add-module=../ngx_lua_upstream-0.07
--add-module=../headers-more-nginx-module-0.33
--add-module=../array-var-nginx-module-0.05
--add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15
--add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.9
--with-ld-opt=-Wl,-rpath,/data/app/openresty/luajit/lib --user=app --group=apps
--add-module=/data/backup/openresty-1.19.3.1/../mod_dubbo
--add-module=/data/backup/openresty-1.19.3.1/../ngx_multi_upstream_module --
add-module=/data/backup/openresty-1.19.3.1/../apisix-nginx-module
--with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module
--with-stream_ssl_preread_module --with-http_v2_module
--without-mail_pop3_module --without-mail_imap_module
--without-mail_smtp_module --with-http_stub_status_module
--with-http_realip_module --with-http_addition_module
--with-http_auth_request_module --with-http_secure_link_module
--with-http_random_index_module --with-http_gzip_static_module
--with-http_sub_module --with-http_dav_module --with-http_flv_module
--with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat
--with-openssl=/data/backup/openresty-1.19.3.1/../openssl-OpenSSL_1_1_1k
--with-openssl-opt=-g --with-stream --with-http_ssl_module
```
* etcd version, if have (cmd: run `curl
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
```shell
[app@VM_97_180_centos apisix]$ curl --cert ./ssl/etcd.pem --key
./ssl/etcd-key.pem --cacert ./ssl/ca.pem -i
https://etcd01.apisix.webank.com:2379/version
{"etcdserver":"3.4.16","etcdcluster":"3.4.0"}
```
* apisix-dashboard version, if have: ```2.6.1```
* 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.
For queries about this service, please contact Infrastructure at:
[email protected]