Certificate error when updating AWS Lambda from Python 3.9 to 3.13

1 week ago 2
ARTICLE AD BOX

I have a lambda in AWS that works fine using Python 3.9. When updating it to the 3.13 runtime, however, it gives me this error: "certificate verify failed: unable to get local issuer certificate"

I can't figure out what is causing this error. Here's the code snippet that deals with the certificate and the HTTP request:

certificate = '/xx/xx.pem' context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.load_cert_chain(certfile=certificate, password=password) connection = http.client.HTTPSConnection(host, port=443, context=context, timeout=20) connection.request(method="POST", url=request_url, headers=headers, body=body) response = connection.getresponse()

The certificate file contains a private key and four certificates.

I've tried making the HTTP request with different libraries, like urllib3, but nothing's worked so far. I've also tried using ssl.PROTOCOL_TLS_CLIENT and setting context.verify_flags &= \~ssl.VERIFY_X509_STRICT but still nothing. I've also tried using the certifi library. I don't know if I just haven't found the right mix of things yet, or what, but I feel like the solution is probably very simple and I just can't see it.

Read Entire Article