3

I have migrated my Python flask app to AWS Lambda after which I started getting the following error of

SSL Verification Failed

Currently using AWS CDK to upload the lambda package and deploying it.

python 3.8 ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1131)

And this is happening on api.pagerduty.com

My requirements.txt file includes PyOpenSSL and Certifi packages, tried different APIs all of them are failing because of SSL verification using requests package's post method

Already know about verify=False attribute but want to fix the problem as to why its happening.

Let me know if you guys need any more details around it, really Appreciate it.

Inderjeet Singh
  • 556
  • 1
  • 9
  • 22
  • Edit: I have tried adding OpenSSL Lambda layer from here https://github.com/alexandredavi/openssl-lambda-layer but still getting the same error. – Inderjeet Singh Oct 13 '22 at 13:12
  • Just to confirm, did you package your dependencies in Linux? Since PyOpenSSL seems to be referring to some C libraries, I think it won't work if you are packaging the dependencies from a Windows machine. – Register Sole Oct 20 '22 at 07:04
  • Yes, I used Ubuntu to create package – Inderjeet Singh Oct 20 '22 at 10:40
  • Ok. Just a suggestion, the guy here https://stackoverflow.com/questions/66924714/eof-occurred-in-violation-of-protocol-ssl-c1125-on-python3-8-slim-buster resolved his issue by reverting to an older base of python:3.7-alpine. Does it work for you if you use Lambda Python 3.7 runtime, instead of 3.8? – Register Sole Oct 21 '22 at 03:51
  • Please update the question with specific versions of PyOpenSSL, Certifi and requests packages. It's also helpful to include a snippet of code of how your app is making the request – Mike Fiedler Dec 07 '22 at 14:21

0 Answers0