You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/11/23 01:35:51 UTC
[GitHub] [apisix] scoolor opened a new issue, #8376: bug: Custom plug-ins developed do not take effect
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: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] scoolor closed issue #8376: request help: custom plugins developed do not take effect
Posted by GitBox <gi...@apache.org>.
scoolor closed issue #8376: request help: custom plugins developed do not take effect
URL: https://github.com/apache/apisix/issues/8376
--
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
[GitHub] [apisix] scoolor commented on issue #8376: request help: custom plugins developed do not take effect
Posted by GitBox <gi...@apache.org>.
scoolor commented on issue #8376:
URL: https://github.com/apache/apisix/issues/8376#issuecomment-1325849490
> > I think the documentation is wrong, about how to develop plug-ins. The custom plugin should be declared in config-default.yaml, not config.yaml.
>
> The documentation is correct. config.yaml will override config-default.yaml. I think you may have the wrong formatting or other errors in the config.yaml configuration.
Yes, config.yaml will override config-default.yaml, I have verified it correctly.
--
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
[GitHub] [apisix] tzssangglass commented on issue #8376: request help: custom plugins developed do not take effect
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #8376:
URL: https://github.com/apache/apisix/issues/8376#issuecomment-1324451013
Are there any other errors in the logs?
Check the permissions of your plugin files.
--
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
[GitHub] [apisix] tzssangglass commented on issue #8376: bug: Custom plug-ins developed do not take effect
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #8376:
URL: https://github.com/apache/apisix/issues/8376#issuecomment-1324449207
have you done with
> To enable your plugin, copy this plugin list into conf/config.yaml, and add your plugin name. For instance:
> ```
> plugins: # copied from config-default.yaml
>
> - your-plugin
> ```
ref: https://github.com/apache/apisix/blob/master/docs/en/latest/plugin-develop.md#name-priority-and-the-others
--
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
[GitHub] [apisix] scoolor commented on issue #8376: request help: custom plugins developed do not take effect
Posted by GitBox <gi...@apache.org>.
scoolor commented on issue #8376:
URL: https://github.com/apache/apisix/issues/8376#issuecomment-1324456316
First of all, thank you for your reply! @tzssangglass
The permissions are as follows:
<img width="672" alt="image" src="https://user-images.githubusercontent.com/20853694/203455969-3cea546d-aa50-4223-b911-675b473fab27.png">
No other error logs were seen.
--
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
[GitHub] [apisix] tzssangglass commented on issue #8376: request help: custom plugins developed do not take effect
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #8376:
URL: https://github.com/apache/apisix/issues/8376#issuecomment-1324637448
> I think the documentation is wrong, about how to develop plug-ins. The custom plugin should be declared in config-default.yaml, not config.yaml.
The documentation is correct. config.yaml will override config-default.yaml. I think you may have the wrong formatting or other errors in the config.yaml configuration.
--
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
[GitHub] [apisix] scoolor commented on issue #8376: request help: custom plugins developed do not take effect
Posted by GitBox <gi...@apache.org>.
scoolor commented on issue #8376:
URL: https://github.com/apache/apisix/issues/8376#issuecomment-1324552512
I think the documentation is wrong, about how to develop plug-ins. The custom plugin should be declared in config-default.yaml, not config.yaml. Then works. @tzssangglass
--
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