Forums

SSLError and SSLEOFError filling my error logs

I'm not sure when this started, but my error logs are full of SSL errors. This is an api accepting requests from a SPA, and I don't see any evidence of cert errors in the website or in the dev tools. I am using the Auto-renewing Let's Encrypt certificate.

I have two apis on the same server, but running in Django with DRF on top. The SSL errors are only showing up on one of the two (api.bhmc.org).

Sample errors:

2022-01-09 18:36:25,727: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)': /api/5577280/envelope/ 2022-01-09 18:36:25,780: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:749)'),)': /api/5577280/envelope/ 2022-01-09 18:36:44,134: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:749)'),)': /api/5577280/envelope/ 2022-01-09 18:37:08,820: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)': /api/5577280/envelope/ 2022-01-09 18:37:08,822: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:749)'),)': /api/5577280/envelope/ 2022-01-09 18:37:08,894: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)':

The reason is most probably that you're on an old system image, updating it should solve the issue, see: https://help.pythonanywhere.com/pages/ChangingSystemImage/.

Thank you for your help. Finally found some time to do the work -- updating the system image was, indeed, what I needed.

Glad to hear that you made it work!

I'm getting a similar error which reads Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))': /api/4506107660599296/envelope/

Lots of them repeat in my error logs

Tried updating to the latest image and python3.10 - but the errors remain. Any hints would be greatly appreciated

That sounds like the API that you're connecting to is breaking the connection; is it an external API?

Hmm... By connection you mean the connection to the website? That comes from a link on a hubspot page. Or did you mean from the flask app to the database (as that also uses SSL I believe)? Flask connects to the database using sqlalchemy which uses psycopg2.

The app uses sentry for error monitoring. Which occurs through the sentry_sdk api.

What is the /api/4506107660599296/envelope/ endpoint?

Good question. Thanks for asking. Giles: Any ideas on how I could find what that maps to in my pythonanywhere webapp?

If /api/4506107660599296/envelope/ is part of an api call that your app is making, you'd probably get a better answer from the support of whatever api that youre calling. I doubt we'd be able to tell you what's happening on their end. Then again you could just catch the error and retry the api call

If /api/4506107660599296/envelope/ is part of an api call that your app is making, you'd probably get a better answer from the support of whatever api that youre calling. I doubt we'd be able to tell you what's happening on their end. Then again you could just catch the error and retry the api call