none
How to allow accessing URLs from service fabric cluster? RRS feed

  • Question

  • I have a python application from which I am trying to connect to couple of URLs.

    When I run the application locally then there is no error. When I build a docker image for the application and run it, then also there is no error. However, when I deploy the docker image into a service fabric cluster, then I get the following error. From a similar question, I understand that this may be related to DNS/proxy issues. Can you suggest some steps to fix this in the service fabric cluster?

    socket.gaierror: [Errno 11002] getaddrinfo failed
    During handling of the above exception, another exception occurred:
    urllib.error.URLError: <urlopen error [Errno 11002] getaddrinfo failed>

    Code:

    import urllib.request as r

    r.urlopen('https://bootstrap.pypa.io').close()


    Traceback:

    Traceback (most recent call last):
      File "C:\Python\lib\urllib\request.py", line 1318, in do_open
        encode_chunked=req.has_header('Transfer-encoding'))
      File "C:\Python\lib\http\client.py", line 1239, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "C:\Python\lib\http\client.py", line 1285, in _send_request
        self.endheaders(body, encode_chunked=encode_chunked)
      File "C:\Python\lib\http\client.py", line 1234, in endheaders
        self._send_output(message_body, encode_chunked=encode_chunked)
      File "C:\Python\lib\http\client.py", line 1026, in _send_output
        self.send(msg)
      File "C:\Python\lib\http\client.py", line 964, in send
        self.connect()
      File "C:\Python\lib\http\client.py", line 1392, in connect
        super().connect()
      File "C:\Python\lib\http\client.py", line 936, in connect
        (self.host,self.port), self.timeout, self.source_address)
      File "C:\Python\lib\socket.py", line 704, in create_connection
        for res in getaddrinfo(host, port, 0, SOCK_STREAM):
      File "C:\Python\lib\socket.py", line 745, in getaddrinfo
        for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    socket.gaierror: [Errno 11002] getaddrinfo failed

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Python\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
        rv = self.dispatch_request()
      File "C:\Python\lib\site-packages\flask\app.py", line 1799, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
      File "C:\app\email_extractor\__init__.py", line 106, in hello_test
        r.urlopen('https://bootstrap.pypa.io').close()
      File "C:\Python\lib\urllib\request.py", line 223, in urlopen
        return opener.open(url, data, timeout)
      File "C:\Python\lib\urllib\request.py", line 526, in open
        response = self._open(req, data)
      File "C:\Python\lib\urllib\request.py", line 544, in _open
        '_open', req)
      File "C:\Python\lib\urllib\request.py", line 504, in _call_chain
        result = func(*args)
      File "C:\Python\lib\urllib\request.py", line 1361, in https_open
        context=self._context, check_hostname=self._check_hostname)
      File "C:\Python\lib\urllib\request.py", line 1320, in do_open
        raise URLError(err)
    urllib.error.URLError: <urlopen error [Errno 11002] getaddrinfo failed>


    Saturday, January 18, 2020 10:32 AM

All replies