rockXiaofeng opened a new issue #3725:
URL: https://github.com/apache/apisix/issues/3725


   ### Issue description
   client: curl
   gateway: Apisix/2.3
   provider server: helloworld/dubbo/go-server/app 
(http://github.com/dubbogo/dubbo-samples)
   Refer to this document: 
https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/dubbo-proxy.md
 to configure upstream and router, the provider configuration is as 
follows(test/server.yml):
   
   application:
     organization : "ikurento.com"
     name : "BDTService"
     module : "dubbogo user-info server"
     version : "0.0.1"
     owner : "ZX"
     environment : "test"
   
   registries :
     "hangzhouzk":
       protocol: "etcdv3"
       timeout  : "3s"
       address: "127.0.0.1:2379"
       username: ""
       password: ""
   
   services:
     "UserProvider":
       registry: "hangzhouzk"
       protocol : "dubbo"
       interface : "com.ikurento.user.UserProvider"
       loadbalance: "random"
       warmup: "100"
       cluster: "failover"
       methods:
       - name: "GetUser"
         retries: 1
         loadbalance: "random"
   
   protocols:
     "dubbo":
       name: "dubbo"
       #    ip : "127.0.0.1"
       port: 20000
   
   The configuration of upstream and router is as follows:
   curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uris": [
           "/hello"
       ],
       "plugins": {
           "dubbo-proxy": {
               "service_name": "UserProvider",
               "service_version": "0.0.1",
               "method": "GetUser"
           }
       },
       "upstream_id": 1
   }'
   
   curl http://127.0.0.1:9080/apisix/admin/upstream/1  -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "nodes": {
           "127.0.0.1:20000": 1
       },
       "type": "roundrobin"
   }'
   
    Get  500 Internal Server Error  after requesting the api (from apisix error 
log):
    2021/03/02 15:02:10 [error] 11720#143808: *1646577 lua entry thread 
aborted: runtime error: .../apisix7/apisix/apisix/plugins/dubbo-proxy.lua:58: 
variable "dubbo_service_name" not found for writing; maybe it is a built-in 
variable that is not changeable or you forgot to use "set $dubbo_service_name 
'';" in the config file to define it first
   stack traceback:
   coroutine 0:
        [C]: in function 'error'
        /usr/local/openresty/lualib/resty/core/var.lua:144: in function 
'__newindex'
        ...eng/myCode/apisix7/apisix/apisix/plugins/dubbo-proxy.lua:58: in 
function 'phase_func'
        .../apisix7/apisix/apisix/plugin.lua:661: in function 'run_plugin'
        .../apisix7/apisix/apisix/init.lua:446: in function 'http_access_phase'
        access_by_lua(nginx.conf:209):2: in main chunk, client: ::1, server: , 
request: "GET /hello HTTP/1.1", host: "localhost:9080"
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 2.3
   * OS (cmd: `uname -a`):  Darwin Kernel Version 20.1.0
   * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):  
openresty/1.19.3.1
   * etcd version, if have (cmd: run `curl 
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API): 
3.5.0
   * apisix-dashboard version, if have: 2.4
   


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


Reply via email to