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 2020/09/02 06:10:06 UTC

[GitHub] [apisix] zhangpjbo opened a new issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

zhangpjbo opened a new issue #2146:
URL: https://github.com/apache/apisix/issues/2146


   ### Issue description
   create a new Lua script and import the external script
   ![cccc](https://user-images.githubusercontent.com/43983137/91937971-abcaf800-ed25-11ea-8044-6a7022409ac8.png)
   the following error occurred when starting APisiX
   ![aa](https://user-images.githubusercontent.com/43983137/91938111-f51b4780-ed25-11ea-9cd4-47a9aef13f08.png)
   
   ### Environment
   
   * apisix version (cmd: `apisix version`):
   * OS:
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] zhangpjbo removed a comment on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

Posted by GitBox <gi...@apache.org>.
zhangpjbo removed a comment on issue #2146:
URL: https://github.com/apache/apisix/issues/2146#issuecomment-685375847


   This is a change made in the source file
   ![error](https://user-images.githubusercontent.com/43983137/91941777-55ad8300-ed2c-11ea-9c79-6c50979799ad.png)
   This is an error message
   ![error2](https://user-images.githubusercontent.com/43983137/91941799-6100ae80-ed2c-11ea-934b-2476cc38f365.jpg)
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] zhangpjbo commented on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

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


   我初步的想法是tcp和udp的代理页面可配置动态化处理,需要把config.yaml文件中的tcp和udp配置动态初始化,由此而延伸出来的问题,在stream_routes.lua文件中添加 local template = require("resty.template"),在重新启动时会出现上述截图的问题。


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] zhangpjbo closed issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

Posted by GitBox <gi...@apache.org>.
zhangpjbo closed issue #2146:
URL: https://github.com/apache/apisix/issues/2146


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] zhangpjbo commented on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

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






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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] zhangpjbo commented on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

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


   Could you please post the configuration of config.yaml during the test? There is no config-default.yaml configuration file in version 1.5.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis commented on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

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


   please provide a full mini example, we need it for confirming


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis commented on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

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


   I make a test right now, it works fine. 
   
   please make sure you are using the right version of APISIX and `conf/config.yaml`.
   
   ```diff
   diff --git a/apisix/admin/stream_routes.lua b/apisix/admin/stream_routes.lua
   index 969f7751..dcd801dc 100644
   --- a/apisix/admin/stream_routes.lua
   +++ b/apisix/admin/stream_routes.lua
   @@ -14,6 +14,7 @@
    -- See the License for the specific language governing permissions and
    -- limitations under the License.
    --
   +local template = require("resty.template")
    local core = require("apisix.core")
    local schema_plugin = require("apisix.admin.plugins").stream_check_schema
    local tostring = tostring
   diff --git a/conf/config-default.yaml b/conf/config-default.yaml
   index 7deb533f..82c7708f 100644
   --- a/conf/config-default.yaml
   +++ b/conf/config-default.yaml
   @@ -85,16 +85,16 @@ apisix:
        http: 'radixtree_uri'         # radixtree_uri: match route by uri(base on radixtree)
                                      # radixtree_host_uri: match route by host + uri(base on radixtree)
        ssl: 'radixtree_sni'          # radixtree_sni: match route by SNI(base on radixtree)
   -  # stream_proxy:                 # TCP/UDP proxy
   -  #   tcp:                        # TCP proxy port list
   -  #     - 9100
   -  #     - 9101
   -  #   udp:                        # UDP proxy port list
   -  #     - 9200
   -  #     - 9211
   -  # dns_resolver:                   # If not set, read from `/etc/resolv.conf`
   -  #  - 1.1.1.1
   -  #  - 8.8.8.8
   +  stream_proxy:                 # TCP/UDP proxy
   +    tcp:                        # TCP proxy port list
   +      - 9100
   +      - 9101
   +    udp:                        # UDP proxy port list
   +      - 9200
   +      - 9211
   +  dns_resolver:                   # If not set, read from `/etc/resolv.conf`
   +   - 1.1.1.1
   +   - 8.8.8.8
      dns_resolver_valid: 30          # valid time for dns result 30 seconds
      resolver_timeout: 5             # resolver timeout
      ssl:
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] zhangpjbo commented on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

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


   我使用的是1.5,局部config.yaml配置如下:
   ![aaaa](https://user-images.githubusercontent.com/43983137/91971768-50f8c700-ed4c-11ea-9e6d-df0a07d43a2c.png)
   
   ![bbbb](https://user-images.githubusercontent.com/43983137/91971896-830a2900-ed4c-11ea-8f4e-7daf31a7e19f.png)
   这两段配置都在,启动会提示我上述异常,若把config.yaml文件的stream_proxy配置全部注释掉,则不会提示错误信息,可以正常启动。


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis commented on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

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


   I try to run with the patch https://github.com/apache/apisix/issues/2146#issuecomment-685491766 with version 1.5.
   
   It works fine. There is no error log.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis commented on issue #2146: request help: I want to create a new Lua script and launch an error when importing an external script. The problem is as follows

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


   ```diff
   diff --git a/apisix/plugins/example-plugin.lua b/apisix/plugins/example-plugin.lua
   index bf368379..cae926e5 100644
   --- a/apisix/plugins/example-plugin.lua
   +++ b/apisix/plugins/example-plugin.lua
   @@ -14,6 +14,7 @@
    -- See the License for the specific language governing permissions and
    -- limitations under the License.
    --
   +local tpl = require("resty.template")
    local core = require("apisix.core")
    local upstream = require("apisix.upstream")
   ```
   
   ![image](https://user-images.githubusercontent.com/6814606/91939881-277a7400-ed29-11ea-93fd-d6cd6d40f0c6.png)
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org