Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Error during consul discovery synchronization when port field is missing in Consul service #11959

Open
zkx5xkt opened this issue Feb 10, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@zkx5xkt
Copy link

zkx5xkt commented Feb 10, 2025

Current Behavior

When Consul discovery is enabled, an error occurs during service synchronization from Consul (attempt to concatenate local 'svc_port' (a nil value)) if not all services in Consul contain the port field.
This leads to the issue where APISIX Consul discovery does not add any services at all.

The error happens here

Expected Behavior

In Consul, the only mandatory field when registering a service is name. Therefore, services that cannot be added to the APISIX discovery should be skipped.

Error Logs

2025/02/10 03:57:40 [error] 32#32: *54 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/discovery/consul/init.lua:525: attempt to concatenate local 'svc_port' (a nil value)

Steps to Reproduce

  1. run consul, register service only with name provided
  2. enable consul discovery in apisix
  3. run apisix via docker image

Environment

  • APISIX version (run apisix version): 3.11.0
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@dosubot dosubot bot added the bug Something isn't working label Feb 10, 2025
@bzp2010
Copy link
Contributor

bzp2010 commented Feb 22, 2025

This means that this node needs to be skipped when the Consul response does not contain the port or any of the fields we need, right?

@zkx5xkt
Copy link
Author

zkx5xkt commented Feb 23, 2025

I think so, I believe this is the expected behavior: if there's no way to route to this service, it won't be added as a candidate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants