You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "mayankmurari (via GitHub)" <gi...@apache.org> on 2025/12/16 13:39:32 UTC
[I] request help: Error loading Custom plugin in Apisix [apisix-ingress-controller]
mayankmurari opened a new issue, #2680:
URL: https://github.com/apache/apisix-ingress-controller/issues/2680
### Issue description
I've created a custom APISIX plugin called `hello-world` that should add a custom header to responses. When I try to place it under apisix path "/usr/local/apisix/apisix/plugins/" where all other inbuild plugins are placed I get error during pod startup.
## Plugin Deployment with APISIX Plugins Path
### 1. ConfigMap
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hello-world-plugin
namespace: apisix-ns
data:
hello-world.lua: |
# [Plugin code]
```
```yaml
customPlugins:
enabled: false
luaPath: "/usr/local/apisix/?.lua;/usr/local/apisix/apisix/plugins/?.lua;"
plugins:
- name: "hello-world"
attrs: {}
# -- plugin codes can be saved inside configmap object.
configMap:
# -- name of configmap.
name: "hello-world-plugin"
mounts:
- key: "hello-world.lua"
path: "/usr/local/apisix/apisix/plugins/hello-world.lua"
```
In this case below error is thrown during pod restart.
`2025/12/16 13:11:30 [error] 10#10: init_by_lua error: /usr/local/openresty/lualib/resty/core/base.lua:80: loop or previous error loading module 'apisix.plugin'
stack traceback:
[C]: in function 'error'
/usr/local/openresty/lualib/resty/core/base.lua:80: in function 'require'
/usr/local/apisix/apisix/plugins/inspect.lua:18: in main chunk
[C]: in function 'require'
/usr/local/apisix/apisix/debug.lua:22: in main chunk
[C]: in function 'require'
/usr/local/apisix/apisix/plugin.lua:20: in main chunk
[C]: in function 'require'
/usr/local/apisix/apisix/init.lua:30: in main chunk
[C]: in function 'require'
init_by_lua:3: in main chunk`
If I try to place plugin in some other custom path the plugin loads without errors.
## Plugin Deployment with APISIX Custom Path
### 1. ConfigMap
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hello-world-plugin
namespace: apisix-ns
data:
hello-world.lua: |
# [Plugin code]
```
```yaml
customPlugins:
enabled: false
luaPath: "/opt/?.lua;/opt/apisix/plugins/?.lua"
plugins:
- name: "hello-world"
attrs: {}
# -- plugin codes can be saved inside configmap object.
configMap:
# -- name of configmap.
name: "hello-world-plugin"
mounts:
- key: "hello-world.lua"
path: "/opt/apisix/plugins/hello-world.lua"
```
I this case I see plugin is executed. So wanted to check if custom plugins needs to be outside of apisix default plugin folder "/usr/local/apisix/apisix/plugins" or is there a way we can have our custom plugins in apisix plugins path and get it executed.
Also what causes the error when plugin is placed inside "/usr/local/apisix/apisix/plugins/" ?
### Environment
- your apisix-ingress-controller version (output of apisix-ingress-controller version --long): 3.13.0
- your Kubernetes cluster version (output of kubectl version): v1.30.10
- if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (uname -a): Linux dashboard-shell-u1set 5.14.0-570.33.2.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 15 17:42:51 UTC 2025 x86_64 GNU/Linux
--
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] request help: Error loading Custom plugin in Apisix [apisix-ingress-controller]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop closed issue #2680: request help: Error loading Custom plugin in Apisix
URL: https://github.com/apache/apisix-ingress-controller/issues/2680
--
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
Re: [I] request help: Error loading Custom plugin in Apisix [apisix-ingress-controller]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #2680:
URL: https://github.com/apache/apisix-ingress-controller/issues/2680#issuecomment-3663527864
Do not add APISIX's plugin directory directly to the lua_package_path (i.e., luaPath), as this will disrupt the namespace referenced by the standard library. If users place custom plugins in the standard plugin directory (/usr/local/apisix/apisix/plugins/), APISIX's default path configuration (/usr/local/apisix/?.lua) is sufficient to load them via `require(“apisix.plugins.hello-world”)`.
--
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
Re: [I] request help: Error loading Custom plugin in Apisix [apisix-ingress-controller]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #2680:
URL: https://github.com/apache/apisix-ingress-controller/issues/2680#issuecomment-3668035776
Hi @mayankmurari, does the problem still exist?
--
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
Re: [I] request help: Error loading Custom plugin in Apisix [apisix-ingress-controller]
Posted by "mayankmurari (via GitHub)" <gi...@apache.org>.
mayankmurari commented on issue #2680:
URL: https://github.com/apache/apisix-ingress-controller/issues/2680#issuecomment-3664556395
@Baoyuantop Verified. Thanks for quick update.
--
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
Re: [I] request help: Error loading Custom plugin in Apisix [apisix-ingress-controller]
Posted by "mayankmurari (via GitHub)" <gi...@apache.org>.
mayankmurari commented on issue #2680:
URL: https://github.com/apache/apisix-ingress-controller/issues/2680#issuecomment-3674656876
@Baoyuantop I updated luaPath for apisix plugin directory "/usr/local/apisix/apisix/plugins/" and it has resolved the issue. Thanks for help.
--
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