mikitex70 / plantuml-markdown

PlantUML plugin for Python-Markdown
BSD 2-Clause "Simplified" License
192 stars 55 forks source link

ConnectionError: [...] Failed to establish a new connection: [Errno 11001] getaddrinfo failed #83

Closed botkero closed 1 year ago

botkero commented 1 year ago

Hello,

Firstly, thank you for this great work here. However, I have come across a hurdle where I don't quite know what the problem is.

I'm not entirely certain that something is misconfigured from my side. Maybe you have some ideas.

First, I would like to use this extension with mkdocs. More specifically mkdocs-material, but that comes with mermaid by default, which, I think, is inferior to plantuml. If I take the default address, it works fine. However, I have my own plantuml instance and it doesn't work with that. The only difference is that one uses http and the other https.

My configuration is simple:

plantuml_markdown:
    server: https://gitlab-plantuml-xxxxxxxxxxx.de/  # fails
    server: http://www.plantuml.com/plantuml # works

This is the error message I receive:

WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000026E50E8D610>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': //png/SoWkIImgAStDuL9GSC_FJwjKqBLJKF3DJCvEhVJDBorEjL98Jip9AOPBs-ZgeaeNfHONvEUb57CvfEQbW0m200==
WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000026E505F71D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': //png/SoWkIImgAStDuL9GSC_FJwjKqBLJKF3DJCvEhVJDBorEjL98Jip9AOPBs-ZgeaeNfHONvEUb57CvfEQbW0m200==
WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000026E50E85210>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': //png/SoWkIImgAStDuL9GSC_FJwjKqBLJKF3DJCvEhVJDBorEjL98Jip9AOPBs-ZgeaeNfHONvEUb57CvfEQbW0m200==
ERROR    -  Error reading page 'gitlab/gitlab.md': HTTPSConnectionPool(host='gitlab-plantuml-xxxxxxxxxxx.de',
            port=443): Max retries exceeded with url:
            //png/SoWkIImgAStDuL9GSC_FJwjKqBLJKF3DJCvEhVJDBorEjL98Jip9AOPBs-ZgeaeNfHONvEUb57CvfEQbW0m200== (Caused by
            NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000026E50E83E90>: Failed to establish a
            new connection: [Errno 11001] getaddrinfo failed'))
ConnectionError: HTTPSConnectionPool(host='gitlab-plantuml-xxxxxxxxxxx.de', port=443): Max retries exceeded with url: //png/SoWkIImgAStDuL9GSC_FJwjKqBLJKF3DJCvEhVJDBorEjL98Jip9AOPBs-ZgeaeNfHONvEUb57CvfEQbW0m200== (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000026E50E83E90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
mikitex70 commented 1 year ago

Hi @botkero, I need some more info to help you:

  1. have you tried calling your personal plantuml with a diagram in a browser? You can use your url by adding /plantuml/png/SoWkIImgAStDuNBAJrBGjLDmpCbCJbMmKiX8pSd9vt98pKi1IW80, which should render a png diagram (maybe the prefix '/plantuml' is not necessary, depending on how you installed plantuml)
  2. at which path is plantuml deployed on your server? Usually plantuml responds in a path /plantuml, in your case it seems to be at the root url
  3. try removing the trailing slash from your URL in the mkdocs configuration: the first three lines of the stack trace refer to a path //png/..., the double slash can interfere with the routing rules on the server (maybe I need to remove the last slash from the server URL if present)
  4. does the installation use a self-signed certificate? I have not tested the plugin with HTTPS and self-signed certificates, maybe I have to manage them (but from the stack trace it seems that it is not the case)
botkero commented 1 year ago
  1. yes, this works perfectly. I can also use the VSCode extension PlantUML and enter my URL there and generate diagrams.
  2. I may need to mention here that the server was set up for me. All I know is that PlantUML is inside a Docker environment.
  3. didn't help, unfortunately. The error message has changed though, if I'm not entirely wrong.
  4. don't know that, saw your reply too late too. I will ask about it on Monday.
WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) 
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
unable to get local issuer certificate (_ssl.c:992)'))': 
/png/SoWkIImgAStDuNBCoKnELT2rKt3AJx9IS2mjoKZDAybCJYp9pCzJ24ejB4qjBk42oYde0jM05MDHLLoGdrUSoeLkM5u-K5sHGY9sGo6ARNHr8QeJSQc66kwGcfS2SZ00 

WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) 
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
unable to get local issuer certificate (_ssl.c:992)'))': 
/png/SoWkIImgAStDuNBCoKnELT2rKt3AJx9IS2mjoKZDAybCJYp9pCzJ24ejB4qjBk42oYde0jM05MDHLLoGdrUSoeLkM5u-K5sHGY9sGo6ARNHr8QeJSQc66kwGcfS2SZ00 

WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) 
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
unable to get local issuer certificate (_ssl.c:992)'))': 
/png/SoWkIImgAStDuNBCoKnELT2rKt3AJx9IS2mjoKZDAybCJYp9pCzJ24ejB4qjBk42oYde0jM05MDHLLoGdrUSoeLkM5u-K5sHGY9sGo6ARNHr8QeJSQc66kwGcfS2SZ00 ERROR - Error reading page 'gitlab/gitlab.md': 

HTTPSConnectionPool(host='gitlab-plantuml.xxxxxxxxx.de', port=443): Max retries exceeded with url: /png/SoWkIImgAStDuNBCoKnELT2rKt3AJx9IS2mjoKZDAybCJYp9pCzJ24ejB4qjBk42oYde0jM05MDHLLoGdrUSoeLkM5u-K5sHGY9sGo6ARNHr8QeJSQc66kwGcfS2SZ00 
(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)'))) 
SSLError: HTTPSConnectionPool(host='gitlab-plantuml.xxxxxxxxx.de', port=443): Max retries exceeded with url: /png/SoWkIImgAStDuNBCoKnELT2rKt3AJx9IS2mjoKZDAybCJYp9pCzJ24ejB4qjBk42oYde0jM05MDHLLoGdrUSoeLkM5u-K5sHGY9sGo6ARNHr8QeJSQc66kwGcfS2SZ00 
(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')))
mikitex70 commented 1 year ago

It's definitely a problem related to an SSL certificate that can't be verified, probably because it's self-signed. You can try to generate a valid certificate using Let's Encrypt, for example using a container with Traefik, but maybe it can be a bit complex if you never used it. I think it would be helpful if I add an option to disable certificate validation, useful at least with development configurations. I'll let you know when I made the change.

mikitex70 commented 1 year ago

Hi @botkero, I've just released the version 3.8.1 which adds the insecure configuration option, which can be used to disable SSL validation checks. In your case set it to True to disable checks, as certificates in your server are not valid (they seems self-signed).

botkero commented 1 year ago

Hi @botkero, I've just released the version 3.8.1 which adds the insecure configuration option, which can be used to disable SSL validation checks. In your case set it to True to disable checks, as certificates in your server are not valid (they seems self-signed).

Hi @mikitex70, now works flawlessly, thank you! Can I appreciate the work with tip?

mikitex70 commented 1 year ago

You are free to do as you like. I added the section for discussions, it could be useful for other situations as well (I didn't know it existed :smile:). Please close this issue is you think the issue has been resolved.