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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to