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 2021/11/03 15:26:20 UTC

[GitHub] [apisix] SSSherg opened a new issue #5415: request help: Custom plugins have no effect

SSSherg opened a new issue #5415:
URL: https://github.com/apache/apisix/issues/5415


   ### Issue description
   
   ![image](https://user-images.githubusercontent.com/37147027/139652389-e74cdf1c-c5a3-4aec-b6a3-2ec650515eec.png)
   ![image](https://user-images.githubusercontent.com/37147027/139652463-13194d35-0e28-484f-afa0-d238ea44e0e1.png)
   容器内jar包启动后,name方法内有打印,但是做插件请求接口测试的时候,filter内无打印没反应。
   之后测试了jwt-auth插件,是有效的,所以猜想是不是ext-plugin-pre-req内的自定义插件无效
   
   ### Environment
   
   - apisix version 2.10
   - OS  Linux master 3.10.0-1160.6.1.el7.x86_64
   - apisix-dashboard version, 2.9.0
   


-- 
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 #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961628654






-- 
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] SSSherg commented on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
SSSherg commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961554397


   In the beginning, it was configured in APISIX Dashboard.There was no indication of a problem!
   ![image](https://user-images.githubusercontent.com/37147027/140441390-1072ae45-4284-4410-a6e6-292f01448c05.png)
   
   when  i use this way:
   `curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri":"/get",
       "plugins":{
           "ext-plugin-pre-req":{
               "conf":[
                   {
                       "name":"TokenValidator",
                       "value":"{\"validate_header\":\"token\",\"validate_url\":\"https://www.sso.foo.com/token/validate\",\"rejected_code\":\"403\"}"
                   }
               ]
           }
       },
       "upstream":{
           "nodes":{
               "httpbin.org:80":1
           },
           "type":"roundrobin"
       }
   }`
   return   '{"error_msg":"unknown plugin [ext-plugin-post-req]"}
   
    I just realized I was missing this plugin!
   
   @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



[GitHub] [apisix] tzssangglass commented on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-959461539


   it looks strange,   if the `ext-plugin-pre-req plugin` is not enabled in `config.yaml`, the plugin runner's logs should not be output.
   
   well, I know why. even if the `ext-plugin-pre-req plugin` is not enabled in `config.yaml`,  APISIX will still run the plugin runner in the `http_init_worker` phase.
   
   see: https://github.com/apache/apisix/blob/10833592282787352ee9960ca1c5593985b785bb/apisix/init.lua#L130
   
   https://github.com/apache/apisix/blob/10833592282787352ee9960ca1c5593985b785bb/apisix/plugins/ext-plugin/init.lua#L778-L797
   
   so we should check in the `init_worker` function of `ext-plugin-*` that `ext-plugin-*` is enabled.
   
   PR is welcome!


-- 
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 #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961190475


   I verified this and I found out that it is not a bug.
   
   ```
   === TEST 1: sanity
   --- yaml_config
   apisix:
       node_listen: 1984
       admin_key: null
   plugins:
     - example-plugin
   --- config
       location /t {
           content_by_lua_block {
               local json = require("toolkit.json")
               local t = require("lib.test_admin")
   
               local code, message, res = t.test('/apisix/admin/routes/1',
                   ngx.HTTP_PUT,
                    [[{
                       "uri": "/hello",
                       "plugins": {
                           "ext-plugin-pre-req": {"a":"b"},
                           "ext-plugin-post-req": {"c":"d"}
                       },
                       "upstream": {
                           "nodes": {
                               "127.0.0.1:1980": 1
                           },
                           "type": "roundrobin"
                       }
                   }]]
               )
   
               if code >= 300 then
                   ngx.status = code
                   ngx.say(message)
                   return
               end
   
               ngx.say(message)
           }
       }
   --- response_body
   passed
   ```
   
   This test case means that add the `ext-plugin-pre-req` plugin when `ext-plugin-post-req` and `ext-plugin-pre-req` are not enabled, then got the fail
   
   ```
   #   Failed test 'TEST 1: sanity - status code ok'
   #   at /usr/local/Cellar/apisix/test-nginx/lib/Test/Nginx/Socket.pm line 948.
   #          got: '400'
   #     expected: '200'
   
   #   Failed test 'TEST 1: sanity - response_body - response is expected (repeated req 0, req 0)'
   #   at /usr/local/Cellar/apisix/test-nginx/lib/Test/Nginx/Socket.pm line 1589.
   #          got: '{"error_msg":"unknown plugin [ext-plugin-post-req]"}
   #
   # '
   #     expected: 'passed
   # '
   # Looks like you failed 2 tests of 4.
   ```
   
   it is not possible to add `ext-plugin-pre-req` plugin.
   
   so I think your reproduction steps are inaccurate.


-- 
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 #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961718563


   > Here the dashboard does not perform a check to make sure that APISIX does have the plugin enabled, it only checks if the data matches the jsonschema.
   
   I think dashboard needs to check that the plugin is enabled, otherwise there will be similar problems.


-- 
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] SSSherg commented on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
SSSherg commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961554397


   In the beginning, it was configured in APISIX Dashboard.There was no indication of a problem!
   ![image](https://user-images.githubusercontent.com/37147027/140441390-1072ae45-4284-4410-a6e6-292f01448c05.png)
   
   when  i use this way:
   `curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri":"/get",
       "plugins":{
           "ext-plugin-pre-req":{
               "conf":[
                   {
                       "name":"TokenValidator",
                       "value":"{\"validate_header\":\"token\",\"validate_url\":\"https://www.sso.foo.com/token/validate\",\"rejected_code\":\"403\"}"
                   }
               ]
           }
       },
       "upstream":{
           "nodes":{
               "httpbin.org:80":1
           },
           "type":"roundrobin"
       }
   }`
   return   '{"error_msg":"unknown plugin [ext-plugin-post-req]"}
   
    I just realized I was missing this plugin!
   
   @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



[GitHub] [apisix] tzssangglass commented on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961628654


   well, then there may be a logical mismatch between dashboard and apisix, thanks for for reporting the problem.
   
   @juzhiyuan @bzp2010 PTAL


-- 
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] bzp2010 commented on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
bzp2010 commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961652104


   Here the dashboard does not perform a check to make sure that APISIX does have the plugin enabled, it only checks if the data matches the jsonschema.


-- 
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] bzp2010 commented on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
bzp2010 commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961652104


   Here the dashboard does not perform a check to make sure that APISIX does have the plugin enabled, it only checks if the data matches the jsonschema.


-- 
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 #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-959461539


   it looks strange,   if the `ext-plugin-pre-req plugin` is not enabled in `config.yaml`, the plugin runner's logs should not be output.
   
   well, I know why. even if the `ext-plugin-pre-req plugin` is not enabled in `config.yaml`,  APISIX will still run the plugin runner in the `http_init_worker` phase.
   
   see: https://github.com/apache/apisix/blob/10833592282787352ee9960ca1c5593985b785bb/apisix/init.lua#L130
   
   https://github.com/apache/apisix/blob/10833592282787352ee9960ca1c5593985b785bb/apisix/plugins/ext-plugin/init.lua#L778-L797
   
   so we should check in the `init_worker` function of `ext-plugin-*` that `ext-plugin-*` is enabled.
   
   PR is welcome!


-- 
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 edited a comment on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass edited a comment on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961628654


   well, then there may be a logical mismatch between dashboard and apisix, @SSSherg thanks for for reporting the problem.
   
   @juzhiyuan @bzp2010 PTAL


-- 
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 edited a comment on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass edited a comment on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961628654


   well, then there may be a logical mismatch between dashboard and apisix, @SSSherg thanks for reporting the problem.
   
   @juzhiyuan @bzp2010 PTAL


-- 
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 #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961628654






-- 
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 #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-959461539






-- 
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] bzp2010 commented on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
bzp2010 commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961652104


   Here the dashboard does not perform a check to make sure that APISIX does have the plugin enabled, it only checks if the data matches the jsonschema.


-- 
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] SSSherg commented on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
SSSherg commented on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961554397


   In the beginning, it was configured in APISIX Dashboard.There was no indication of a problem!
   ![image](https://user-images.githubusercontent.com/37147027/140441390-1072ae45-4284-4410-a6e6-292f01448c05.png)
   
   when  i use this way:
   `curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri":"/get",
       "plugins":{
           "ext-plugin-pre-req":{
               "conf":[
                   {
                       "name":"TokenValidator",
                       "value":"{\"validate_header\":\"token\",\"validate_url\":\"https://www.sso.foo.com/token/validate\",\"rejected_code\":\"403\"}"
                   }
               ]
           }
       },
       "upstream":{
           "nodes":{
               "httpbin.org:80":1
           },
           "type":"roundrobin"
       }
   }`
   return   '{"error_msg":"unknown plugin [ext-plugin-post-req]"}
   
    I just realized I was missing this plugin!
   
   @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



[GitHub] [apisix] tzssangglass edited a comment on issue #5415: request help: Custom plugins have no effect

Posted by GitBox <gi...@apache.org>.
tzssangglass edited a comment on issue #5415:
URL: https://github.com/apache/apisix/issues/5415#issuecomment-961628654






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