Module 'kong.plugins.base_plugin' not found
Closed this issue · 4 comments
nguyentritai2906 commented
I got this error when build and run the docker image using the included Dockerfile
Here's the stacktrace:
kong-gateway | nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/tools/utils.lua:701: error loading module 'kong.plugins.oidc.handler':
kong-gateway | /usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:1: module 'kong.plugins.base_plugin' not found:No LuaRocks module found for kong.plugins.base_plugin
kong-gateway | no field package.preload['kong.plugins.base_plugin']
kong-gateway | no file './kong/plugins/base_plugin.lua'
kong-gateway | no file './kong/plugins/base_plugin/init.lua'
kong-gateway | no file '/usr/local/openresty/site/lualib/kong/plugins/base_plugin.ljbc'
kong-gateway | no file '/usr/local/openresty/site/lualib/kong/plugins/base_plugin/init.ljbc'
kong-gateway | no file '/usr/local/openresty/lualib/kong/plugins/base_plugin.ljbc'
kong-gateway | no file '/usr/local/openresty/lualib/kong/plugins/base_plugin/init.ljbc'
kong-gateway | no file '/usr/local/openresty/site/lualib/kong/plugins/base_plugin.lua'
kong-gateway | no file '/usr/local/openresty/site/lualib/kong/plugins/base_plugin/init.lua'
kong-gateway | no file '/usr/local/openresty/lualib/kong/plugins/base_plugin.lua'
kong-gateway | no file '/usr/local/openresty/lualib/kong/plugins/base_plugin/init.lua'
kong-gateway | no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/kong/plugins/base_plugin.lua'
kong-gateway | no file '/usr/local/share/lua/5.1/kong/plugins/base_plugin.lua'
kong-gateway | no file '/usr/local/share/lua/5.1/kong/plugins/base_plugin/init.lua'
kong-gateway | no file '/usr/local/openresty/luajit/share/lua/5.1/kong/plugins/base_plugin.lua'
kong-gateway | no file '/usr/local/openresty/luajit/share/lua/5.1/kong/plugins/base_plugin/init.lua'
kong-gateway | no file '/root/.luarocks/share/lua/5.1/kong/plugins/base_plugin.lua'
kong-gateway | no file '/root/.luarocks/share/lua/5.1/kong/plugins/base_plugin/init.lua'
kong-gateway | no file '/usr/local/openresty/site/lualib/kong/plugins/base_plugin.so'
kong-gateway | no file '/usr/local/openresty/lualib/kong/plugins/base_plugin.so'
kong-gateway | no file './kong/plugins/base_plugin.so'
kong-gateway | no file '/usr/local/lib/lua/5.1/kong/plugins/base_plugin.so'
kong-gateway | no file '/usr/local/openresty/luajit/lib/lua/5.1/kong/plugins/base_plugin.so'
kong-gateway | no file '/usr/local/lib/lua/5.1/loadall.so'
kong-gateway | no file '/root/.luarocks/lib/lua/5.1/kong/plugins/base_plugin.so'
kong-gateway | no file '/usr/local/openresty/site/lualib/kong.so'
kong-gateway | no file '/usr/local/openresty/lualib/kong.so'
kong-gateway | no file './kong.so'
kong-gateway | no file '/usr/local/lib/lua/5.1/kong.so'
kong-gateway | no file '/usr/local/openresty/luajit/lib/lua/5.1/kong.so'
kong-gateway | no file '/usr/local/lib/lua/5.1/loadall.so'
kong-gateway | no file '/root/.luarocks/lib/lua/5.1/kong.so'
kong-gateway | stack traceback:
kong-gateway | [C]: in function 'require'
kong-gateway | /usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:1: in main chunk
kong-gateway | [C]: at 0xffffa21e90a8
kong-gateway | [C]: in function 'xpcall'
kong-gateway | /usr/local/share/lua/5.1/kong/tools/utils.lua:692: in function 'load_module_if_exists'
kong-gateway | /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:154: in function 'load_plugin_handler'
kong-gateway | /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:260: in function 'load_plugin'
kong-gateway | /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:312: in function 'load_plugin_schemas'
kong-gateway | /usr/local/share/lua/5.1/kong/init.lua:553: in function 'init'
kong-gateway | init_by_lua:3: in main chunk
kong-gateway | stack traceback:
kong-gateway | [C]: in function 'error'
kong-gateway | /usr/local/share/lua/5.1/kong/tools/utils.lua:701: in function 'load_module_if_exists'
kong-gateway | /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:154: in function 'load_plugin_handler'
kong-gateway | /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:260: in function 'load_plugin'
kong-gateway | /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:312: in function 'load_plugin_schemas'
kong-gateway | /usr/local/share/lua/5.1/kong/init.lua:553: in function 'init'
kong-gateway | init_by_lua:3: in main chunk
kong-gateway exited with code 1
docker-compose.yml:
version: '3'
services:
kong-database:
image: postgres:9.6
container_name: kong-database
restart: always
networks:
- kong-net
environment:
- POSTGRES_DB=kong
- POSTGRES_USER=kong
- POSTGRES_PASSWORD=kongpass
ports:
- 5432:5432
volumes:
- "./postgres/database:/var/lib/postgresql/data"
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 5s
timeout: 5s
retries: 5
kong-migrations:
# image: kong/kong-gateway:3.0.0.0-alpine
image: kong-oidc
container_name: kong-migrations
restart: on-failure
command: kong migrations bootstrap -v
networks:
- kong-net
environment:
- KONG_PG_HOST=kong-database
- KONG_DATABASE=postgres
- KONG_PG_USER=kong
- KONG_PG_PASSWORD=kongpass
- KONG_PLUGINS=bundled,oidc
depends_on:
kong-database:
condition: service_healthy
kong-gateway:
# image: kong/kong-gateway:3.0.0.0-alpine
image: kong-oidc
container_name: kong-gateway
user: root
restart: on-failure
networks:
- kong-net
environment:
- LC_CTYPE=en_US.UTF-8
- LC_ALL=en_US.UTF-8
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-database
- KONG_PG_USER=kong
- KONG_PG_PASSWORD=kongpass
- KONG_PROXY_ACCESS_LOG=/dev/stdout
- KONG_ADMIN_ACCESS_LOG=/dev/stdout
- KONG_PROXY_ERROR_LOG=/dev/stderr
- KONG_ADMIN_ERROR_LOG=/dev/stderr
- KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
- KONG_ADMIN_GUI_URL=http://localhost:8002
- KONG_PLUGINS=bundled,oidc
ports:
- 8000:8000
- 8443:8443
- 8001:8001
- 8444:8444
- 8002:8002
- 8445:8445
- 8003:8003
- 8004:8004
depends_on:
kong-migrations:
condition: service_started
konga:
image: pantsel/konga
container_name: konga
networks:
- kong-net
ports:
- 1337:1337
environment:
- DB_ADAPTER=postgres
- DB_HOST=kong-database
- DB_PORT=5432
- DB_DATABASE=kong
- DB_USER=kong
- DB_PASSWORD=kongpass
# - NODE_ENV=production
- NODE_ENV=development
depends_on:
kong-database:
condition: service_healthy
keycloak:
image: quay.io/keycloak/keycloak:19.0.1
container_name: keycloak
command: start-dev
networks:
- kong-net
ports:
- 8080:8080
environment:
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
- KEYCLOAK_LOGLEVEL=ALL
volumes:
postgres:
driver: local
networks:
kong-net:
driver: bridge
cristichiru commented
Indeed, there was a problem in kong-oidc plugin. I have updated it to respect the new Kong 3 specs.
Tested and seems to work fine now. Please use tag https://github.com/revomatico/docker-kong-oidc/tree/3.0.0-4
nguyentritai2906 commented
Everything works now, thanks
nguyentritai2906 commented
I hit this error when trying to hit the http://localhost:8000/mock
that might be related to this.
Should I open a new issue for this? Hope you can help
kong | 2022/09/18 05:18:47 [error] 2389#0: *653 [kong] init.lua:311 [oidc] /usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:11: attempt to index field 'super' (a nil value), client: 172.27.0.1, server: kong, request: "GET /mock HTTP/1.1", host: "localhost:8000"
cr1cr1 commented
Should be fixed in https://github.com/revomatico/docker-kong-oidc/releases/tag/3.0.0-5