keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
183 stars 43 forks source link

Failed eureka connection on UAT #83

Open AAyiku opened 3 months ago

AAyiku commented 3 months ago

Hi @keijack I am having issues with connecting my python fastapi app to the discovery server on a UAT environment. However, I have no issues connecting to my discovery server locally. Here is the code snippet:

[2024-05-07 10:38:28]-[Thread-1]-[eureka_client:633] WARNING: Eureka server ["http://discoveryserver.kowri.uat:8080/eureka/"] is down, use next url to try. Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 631, in __try_eureka_servers_in_list await fun(url) File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 709, in do_register await _register(url, self.__instance) File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_basic.py", line 301, in _register req = http_client.HttpRequest(f"{_format_url(eureka_server)}apps/{quote(instance_dic['app'])}", File "/usr/local/lib/python3.9/site-packages/py_eureka_client/http_client.py", line 82, in __init__ raise URLError("Unvalid URL") urllib.error.URLError: <urlopen error Unvalid URL> [2024-05-07 10:38:29]-[Thread-1]-[eureka_client:713] WARNING: Register error! Will try in next heartbeat. Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 616, in __try_all_eureka_servers await self.__try_eureka_server_in_zone(fun) File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 586, in __try_eureka_server_in_zone await self.__try_eureka_servers_in_list( File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 643, in __try_eureka_servers_in_list raise EurekaServerConnectionException( py_eureka_client.eureka_client.EurekaServerConnectionException: <urlopen error All eureka servers in zone[default] are down!> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 710, in register await self.__connect_to_eureka_server(do_register) File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 653, in __connect_to_eureka_server await self.__try_all_eureka_servers(fun) File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 618, in __try_all_eureka_servers await self.__try_eureka_server_not_in_zone(fun) File "/usr/local/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 598, in __try_eureka_server_not_in_zone raise EurekaServerConnectionException( py_eureka_client.eureka_client.EurekaServerConnectionException: <urlopen error All eureka servers in all zone are down!>

Any sort of help will be very appreciated!

keijack commented 3 months ago

What if you use curl to visit http://discoveryserver.kowri.uat:8080/eureka/ ?

AAyiku commented 3 months ago

It is an internal link, so it can't be accessed locally

AAyiku commented 3 months ago

@keijack would the library be able to connect to a proxy server, that gives access to a the discovery server?

keijack commented 3 months ago

Currently no, pythone-eureka-client cannot connect to a eureka server via a proxy server, however, you can define your own HttpClient to do it.