Resolving SSL: CERTIFICATE_VERIFY_FAILED Error
While developing a custom app on Frappe Cloud, you may encounter the SSL: CERTIFICATE_VERIFY_FAILED error when trying to connect to an external endpoint outside Frappe Cloud.
This issue usually occurs due to one of the following reasons:
1. SSL Configuration Issue on the External Server
The server you are connecting to may not be configured correctly for SSL. In some cases, the server does not provide the complete certificate chain, which prevents Python’s SSL module from validating the TLS connection.
Browsers may still connect successfully because they support additional certificate discovery mechanisms such as AIA (Authority Information Access).
You can verify the SSL configuration of the external server using online SSL testing tools.
Solution
The external server should be configured to correctly serve the complete SSL certificate chain.
2. Python Cannot Access the System Certificate Store
Another possible cause is that Python is unable to use the operating system’s certificate store to validate SSL certificates.
To resolve this issue, install the pip-system-certs package in your custom app.
Installing pip-system-certs
Add the package as a dependency in your custom app instead of manually installing it.
You can add it through your app’s dependency file:
- pyproject.toml under the dependencies section
- requirements.txt file in the root directory of your app
Note
After adding the dependency, redeploy your app so that Frappe Cloud can install and apply the package.