membphis commented on code in PR #12448:
URL: https://github.com/apache/apisix/pull/12448#discussion_r2261762549


##########
apisix/discovery/consul/init.lua:
##########
@@ -511,11 +515,19 @@ function _M.connect(premature, consul_server, retry_delay)
                 local nodes = up_services[service_name]
                 local nodes_uniq = {}
                 for _, node in ipairs(result.body) do
-                    if not node.Service then
+                    local service = node.Service
+                    if not service then
                         goto CONTINUE
                     end
 
-                    local svc_address, svc_port = node.Service.Address, 
node.Service.Port
+                    local svc_address = service.Address
+                    local svc_port = service.Port
+                    local metadata = service.Meta
+                    -- ensure that metadata is an accessible table,
+                    -- avoid userdata likes `null` returned by cjson
+                    if type(metadata) ~= "table" then

Review Comment:
   pls take a look, skip current service if the `metadat` is invalid
   
   ```
   if type(metadata) == "cdata" then
      metadata = nil
   elseif type(metadata) ~= "table" then
      core.log.error("wrong meta data, ...", ...)
      goto CONTINUE
   end



-- 
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-unsubscr...@apisix.apache.org

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

Reply via email to