This error is caused by an issue with the certificate authority that issued your THREDDS certificate not being recognized. This can and does happen with valid certificates often. Tethys uses a library called
Siphon to interact with THREDDS services and Siphon uses the
Requests library behind the scenes to issue the HTTP requests to the server. Requests uses a default Certificate Authority (CA) Bundle to validate SSL requests. The bundle is called something like cacert.pem and is installed as part of the certifi package in site-packages. This CA default bundle is not all-inclusive and is provided more for convenience of development.
You have a few options if the authority that issued your certificate is not included in the default certifi package:
1. You can disable SSL checks. If you were using the Requests library directly, this is easily done by setting the verify parameter to False (see:
https://2.python-requests.org/en/v1.1.0/user/advanced/#ssl-cert-verification). Since we don't have direct control over how Siphon is making Requests calls, this can be done using the tip in the tutorial (see Tip box at the end of step 3.2 of the Visualize THREDDS Services with Leaflet).
I ONLY recommend this as a temporary workaround for development and not in production (see next suggestion).
2. For production, you will need to provide your own CA bundle that contains the PEM key for the certificate authority that issued your certificate for your THREDDS server. You can override the default CA bundle used by Requests using the REQUESTS_CA_BUNDLE environment variable. Set this variable to the path to your custom CA bundle. A few suggestions for custom CA bundles:
- Try using the system certificates. On Ubuntu / Debian these are usually located at /etc/ssl/certs/ca-certficiates.crt
- Copy the default CA bundle from certifi and append the key for your certificate authority to the end of it. How to get the key for your certificate authority depends on the authority. You'll need to look it up in their documentation, likely.
Note that this same discussion applies to SSL issues with using owslib.