You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "wensenz (via GitHub)" <gi...@apache.org> on 2024/05/24 03:32:07 UTC
[I] bug: 49#49: *543808 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/core/request.lua:118: bad argument #1 to 'lower' [apisix]
wensenz opened a new issue, #11285:
URL: https://github.com/apache/apisix/issues/11285
### Current Behavior
2024/05/24 02:14:01 [error] 49#49: *543808 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/core/request.lua:118: bad argument #1 to 'lower' (string expected, got nil)
stack traceback:
coroutine 0:
[C]: in function 'lower'
/usr/local/openresty/lualib/resty/core/request.lua:118: in function '__index'
/usr/local/apisix/apisix/core/request.lua:110: in function 'header'
/usr/local/apisix/apisix/plugins/key-auth.lua:71: in function 'phase_fun'
[string "route#514932448631456457"]:17: in function 'phase_func'
/usr/local/apisix/apisix/script.lua:52: in function 'run'
/usr/local/apisix/apisix/init.lua:690: in function 'http_access_phase'
access_by_lua(nginx.conf:317):2: in main chunk, client: 172.23.0.1, server: _, request: "GET /headers HTTP/1.1", host: "links.api-connect.vip"
### Expected Behavior
_No response_
### Error Logs
2024/05/24 02:14:01 [error] 49#49: *543808 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/core/request.lua:118: bad argument #1 to 'lower' (string expected, got nil)
stack traceback:
coroutine 0:
[C]: in function 'lower'
/usr/local/openresty/lualib/resty/core/request.lua:118: in function '__index'
/usr/local/apisix/apisix/core/request.lua:110: in function 'header'
/usr/local/apisix/apisix/plugins/key-auth.lua:71: in function 'phase_fun'
[string "route#514932448631456457"]:17: in function 'phase_func'
/usr/local/apisix/apisix/script.lua:52: in function 'run'
/usr/local/apisix/apisix/init.lua:690: in function 'http_access_phase'
access_by_lua(nginx.conf:317):2: in main chunk, client: 172.23.0.1, server: _, request: "GET /headers HTTP/1.1"
### Steps to Reproduce
use APISIX Dashboard config
consumers :
```
{
"username": "zhongzong",
"plugins": {
"key-auth": {
"_meta": {
"disable": false
},
"key": "auth-one"
}
}
}
```
routes:

got-json:
```
{
"uri": "/headers",
"name": "getting-started-headers",
"script": {
"chart": {
"cells": [
{
"attrs": {
"line": {
"stroke": "#5F95FF",
"strokeWidth": 1,
"targetMarker": {
"name": "classic",
"size": 8
}
}
},
"id": "54ef99fb-cd23-48b5-a489-ab94cdbc4e2b",
"router": {
"name": "manhattan"
},
"shape": "edge",
"source": {
"cell": "18837239-661c-4d5e-9758-da9514042430",
"port": "d2ea18cf-6aa5-4b64-abfd-f21717b17d7e"
},
"target": {
"cell": "a23bc580-c1b6-4214-bd14-d6b7250f5c92",
"port": "a8f97f78-44ff-4b69-b872-5c6c10caf178"
},
"zIndex": 0
},
{
"attrs": {
"line": {
"stroke": "#5F95FF",
"strokeWidth": 1,
"targetMarker": {
"name": "classic",
"size": 8
}
}
},
"id": "80f4a09d-6674-4b83-82fa-b64825b0c81f",
"router": {
"name": "manhattan"
},
"shape": "edge",
"source": {
"cell": "a23bc580-c1b6-4214-bd14-d6b7250f5c92",
"port": "c4700cfc-76b2-454f-b205-647123e5af76"
},
"target": {
"cell": "a5439296-d286-44b0-88d5-564a9019a0d8",
"port": "8b1aff33-52b0-4bcc-a222-6727be437aee"
},
"zIndex": 0
},
{
"attrs": {
"line": {
"stroke": "#5F95FF",
"strokeWidth": 1,
"targetMarker": {
"name": "classic",
"size": 8
}
}
},
"id": "4156ad96-87fb-4cad-9e46-af385d755700",
"router": {
"name": "manhattan"
},
"shape": "edge",
"source": {
"cell": "a5439296-d286-44b0-88d5-564a9019a0d8",
"port": "70eca251-9016-4f57-93e1-8821fb504b29"
},
"target": {
"cell": "8246f592-4ed5-4a15-9a11-822674737163",
"port": "11512570-4ccc-438e-84fe-9d98b319a32d"
},
"zIndex": 0
},
{
"angle": 45,
"attrs": {
"text": {
"textWrap": {
"text": "条件判断"
},
"transform": "rotate(-45deg)"
}
},
"data": "code==200",
"id": "a5439296-d286-44b0-88d5-564a9019a0d8",
"ports": {
"groups": {
"bottom": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": {
"args": {
"dx": 26
},
"name": "bottom"
}
},
"left": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": {
"args": {
"dy": 26
},
"name": "left"
}
},
"right": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": {
"args": {
"dy": -26
},
"name": "right"
}
},
"top": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": {
"args": {
"dx": -26
},
"name": "top"
}
}
},
"items": [
{
"group": "top",
"id": "8b1aff33-52b0-4bcc-a222-6727be437aee"
},
{
"group": "right",
"id": "d6b114a1-7f15-48f6-8c93-fe7c5426ead9"
},
{
"group": "bottom",
"id": "70eca251-9016-4f57-93e1-8821fb504b29"
}
]
},
"position": {
"x": 219.98780669118025,
"y": 270
},
"shape": "flow-chart-condition-rect",
"size": {
"height": 58,
"width": 58
},
"zIndex": 1
},
{
"attrs": {
"body": {
"rx": 24,
"ry": 24
},
"text": {
"textWrap": {
"text": "开始"
}
}
},
"id": "18837239-661c-4d5e-9758-da9514042430",
"ports": {
"groups": {
"bottom": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": "bottom"
},
"left": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": "left"
},
"right": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": "right"
},
"top": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": "top"
}
},
"items": [
{
"group": "bottom",
"id": "d2ea18cf-6aa5-4b64-abfd-f21717b17d7e"
}
]
},
"position": {
"x": 160,
"y": -6
},
"shape": "flow-chart-start-rect",
"size": {
"height": 42,
"width": 80
},
"zIndex": 2
},
{
"attrs": {
"text": {
"text": "key-auth"
},
"title": {
"text": "key-auth"
}
},
"data": {
"disable": false
},
"id": "a23bc580-c1b6-4214-bd14-d6b7250f5c92",
"ports": {
"groups": {
"bottom": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": "bottom"
},
"top": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": "top"
}
},
"items": [
{
"group": "top",
"id": "a8f97f78-44ff-4b69-b872-5c6c10caf178"
},
{
"group": "bottom",
"id": "c4700cfc-76b2-454f-b205-647123e5af76"
}
]
},
"position": {
"x": 100.01219330881975,
"y": 107
},
"shape": "flow-chart-plugin-rect",
"size": {
"height": 60,
"width": 200
},
"zIndex": 3
},
{
"attrs": {
"text": {
"text": "limit-count"
},
"title": {
"text": "limit-count"
}
},
"data": {
"allow_degradation": false,
"count": 2,
"disable": false,
"key": "$consumer_name",
"key_type": "var_combination",
"policy": "redis",
"redis_database": 0,
"redis_host": "172.23.0.9",
"redis_password": "xxx",
"redis_port": 6379,
"redis_timeout": 1000,
"rejected_code": 503,
"rejected_msg": "您的请求流量已用完,请找客服充值!",
"show_limit_quota_header": true,
"time_window": 60
},
"id": "8246f592-4ed5-4a15-9a11-822674737163",
"ports": {
"groups": {
"bottom": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": "bottom"
},
"top": {
"attrs": {
"circle": {
"fill": "#fff",
"magnet": true,
"r": 3,
"stroke": "#5F95FF",
"strokeWidth": 1,
"style": {
"visibility": "hidden"
}
}
},
"position": "top"
}
},
"items": [
{
"group": "top",
"id": "11512570-4ccc-438e-84fe-9d98b319a32d"
},
{
"group": "bottom",
"id": "3602d70a-eb80-4fc8-ba7b-76f5fb79a5c6"
}
]
},
"position": {
"x": 100,
"y": 430
},
"shape": "flow-chart-plugin-rect",
"size": {
"height": 60,
"width": 200
},
"zIndex": 4
}
]
},
"conf": {
"8246f592-4ed5-4a15-9a11-822674737163": {
"conf": {
"allow_degradation": false,
"count": 2,
"disable": false,
"key": "$consumer_name",
"key_type": "var_combination",
"policy": "redis",
"redis_database": 0,
"redis_host": "172.23.0.9",
"redis_password": "xxx",
"redis_port": 6379,
"redis_timeout": 1000,
"rejected_code": 503,
"rejected_msg": "您的请求流量已用完,请找客服充值!",
"show_limit_quota_header": true,
"time_window": 60
},
"name": "limit-count"
},
"a23bc580-c1b6-4214-bd14-d6b7250f5c92": {
"conf": {
"disable": false
},
"name": "key-auth"
}
},
"rule": {
"a23bc580-c1b6-4214-bd14-d6b7250f5c92": [
[
"code==200",
"8246f592-4ed5-4a15-9a11-822674737163"
]
],
"root": "a23bc580-c1b6-4214-bd14-d6b7250f5c92"
}
},
"script_id": "514932448631456457",
"upstream": {
"nodes": [
{
"host": "httpbin.org",
"port": 80,
"weight": 1
}
],
"timeout": {
"connect": 6,
"send": 6,
"read": 6
},
"type": "roundrobin",
"scheme": "http",
"pass_host": "pass",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
}
},
"status": 1
}
```
### Environment
i use docker-compose:
```
version: "3"
services:
apisix:
image: apache/apisix:${APISIX_IMAGE_TAG:-3.9.0-debian}
restart: always
volumes:
- ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
- ./apisix_conf/debug.yaml:/usr/local/apisix/conf/debug.yaml:ro
depends_on:
- etcd
##network_mode: host
ports:
- "9180:9180/tcp"
- "9080:9080/tcp"
- "9091:9091/tcp"
- "9443:9443/tcp"
- "9092:9092/tcp"
networks:
apisix:
apisix-dashboard:
image: apache/apisix-dashboard:3.0.1-alpine
restart: always
volumes:
- ./dashboard_conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml:ro
depends_on:
- etcd
ports:
- "9000:9000"
networks:
apisix:
etcd:
image: bitnami/etcd:3.5.11
restart: always
volumes:
- etcd_data:/bitnami/etcd
environment:
ETCD_ENABLE_V2: "true"
ALLOW_NONE_AUTHENTICATION: "yes"
ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379"
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
ports:
- "2379:2379/tcp"
networks:
apisix:
web1:
image: nginx:1.19.0-alpine
restart: always
volumes:
- ./upstream/web1.conf:/etc/nginx/nginx.conf
ports:
- "9081:80/tcp"
environment:
- NGINX_PORT=80
networks:
apisix:
web2:
image: nginx:1.19.0-alpine
restart: always
volumes:
- ./upstream/web2.conf:/etc/nginx/nginx.conf
ports:
- "9082:80/tcp"
environment:
- NGINX_PORT=80
networks:
apisix:
prometheus:
image: prom/prometheus:v2.25.0
restart: always
volumes:
- ./prometheus_conf/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
networks:
apisix:
grafana:
image: grafana/grafana:7.3.7
restart: always
ports:
- "3000:3000"
volumes:
- "./grafana_conf/provisioning:/etc/grafana/provisioning"
- "./grafana_conf/dashboards:/var/lib/grafana/dashboards"
- "./grafana_conf/config/grafana.ini:/etc/grafana/grafana.ini"
networks:
apisix:
networks:
apisix:
driver: bridge
volumes:
etcd_data:
driver: local
```
- APISIX version (run `apisix version`): 3.9.0
- Operating system (run `uname -a`):
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
- etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
- APISIX Dashboard version, if relevant: 3.0.1-alpine
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run `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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: 49#49: *543808 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/core/request.lua:118: bad argument #1 to 'lower' [apisix]
Posted by "fserafini-DQ (via GitHub)" <gi...@apache.org>.
fserafini-DQ commented on issue #11285:
URL: https://github.com/apache/apisix/issues/11285#issuecomment-2154401963
Hello @wensenz, also happened to me, it seems related to the plugin configuration.
To solve you need to pass the optional property header, on the plugin config, like this:
```
{
"disable": false,
"header": "apikey",
"key": "your-key"
}
```
--
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