anvil.http.HttpRequestFailed: SSL error: PKIX path building failed

Hello there, I am getting the same error in 2025. A bit of search sent me here.

We are setup with anvil enterprise. trying to access another anvil app from anvil app residing in the same server.

I tried this from REPL :
result = anvil.http.request(‘https://xxx.apps.anvil.corp.ourcorp.com/’)

where https://xxx.apps.anvil.corp.ourcorp.com/ is another app on the same server.

And getting this :
anvil.http.HttpRequestFailed: SSL error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Any help is appreciated.

Peter

Hi @subiantopeter,

Three things:

  1. That error usually indicates a failure in certificate validation, specifically because the target is not signed by a certificate authority that Anvil trusts. (Usually, this means self-signed certificates or a private corporate certificate authority.)

  2. What about using the standard Python requests module instead of anvil.http - does this request work that way? In Enterprise environments with custom corporate CAs, customers typically configure the server environment to be preloaded with the right certificates, but this won’t necessarily work for anvil.http. Can you try hitting that same URL with the requests module and see if it works?

  3. As your organisation has Anvil Enterprise, you do have direct access to our team at support@anvil.works, who can get back to you the next day rather than the next week! If the above didn’t help, drop us a line there :slight_smile:

Thank you for the explanation.
Python requests works, since it has the verify=False option. This should suffice for now since we use it internally.
If we need to in the future we will reach out to the team.

Thank you.