scoolor opened a new issue, #8376:
URL: https://github.com/apache/apisix/issues/8376

   ### Current Behavior
   
   version: 3.0.0
   
   apisix config: apisix_conf/config.yaml
   
   `apisix:
     node_listen: 9080              # APISIX listening port
     enable_ipv6: false
   
     enable_control: true
     control:
       ip: "0.0.0.0"
       port: 9092
     extra_lua_path: "/usr/local/apisix/?.lua"
   plugins:
     - test3`
   
   plugin path: /usr/local/apisix/apisix/plugins
   
   plugin code:
   `
   local core         =   require("apisix.core")
   local plugin       =   require("apisix.plugin")
   local ngx          =   ngx
   
   local plugin_name = "test3"
   
   local schema = {
       type = "object",
       properties = {
           path = {
               type = "string"
           },
       },
       required = {"path"}
   }
   
   local metadata_schema = {
       type = "object",
       properties = {
           log_format = log_util.metadata_schema_log_format
       }
   }
   
   
   local _M = {
       version = 0.1,
       priority = 901,
       name = plugin_name,
       schema = schema,
       metadata_schema = metadata_schema
   }
   
   function _M.check_schema(conf, schema_type)
       if schema_type == core.schema.TYPE_METADATA then
           return core.schema.check(metadata_schema, conf)
       end
       return core.schema.check(schema, conf)
   end
   
   function _M.log(conf, ctx)
       core.log.warn("conf: ", core.json.encode(conf))
       core.log.warn("ctx: ", core.json.encode(ctx, true))
   end
   
   
   return _M`
   
   error screenshot:
   
   `curl "http://127.0.0.1:9180/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
   {
     "methods": ["GET"],
     "host": "example.com",
     "uri": "/get",
     "upstream": {
       "type": "roundrobin",
       "nodes": {
         "httpbin.org:80": 1
       }
     },
     "plugins": {
       "test3": {
         "path": "logs/file.log"
       }
     }
   }'
   {"error_msg":"unknown plugin [test3]"}`
   
   
   ### Expected Behavior
   
   _No response_
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   After the custom plug-in is configured, run:
   `curl http://127.0.0.1:9180/apisix/admin/plugins/reload -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT`
   
   use plugin:
   `curl "http://127.0.0.1:9180/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
   {
     "methods": ["GET"],
     "host": "example.com",
     "uri": "/get",
     "upstream": {
       "type": "roundrobin",
       "nodes": {
         "httpbin.org:80": 1
       }
     },
     "plugins": {
       "test3": {
         "path": "logs/file.log"
       }
     }
   }'`
   
   get:
   `{"error_msg":"unknown plugin [test3]"}`
   
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.0.0
   - Operating system (run `uname -a`): Linux c0c0328d7e95 5.15.49-linuxkit #1 
SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): nginx 
version: openresty/1.21.4.1
   


-- 
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