Azure Function randomly fails with 'OSError: Could not find a suitable TLS CA certificate bundle'
Hi, when I deploy a Function App with Terraform, sometimes the following error may show up in some of the functions:
Traceback (most recent call last): File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/messages/abstract_trigger_handler.py", line 90, in _perform_transaction File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/messages/abstract_trigger_handler.py", line 80, in _perform_transaction File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/sp_folder/sp_folder_icc.py", line 56, in process_data File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/sp_folder/sp_folder_icc.py", line 105, in check_sp_drive File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/http_wrapper/sp_graph_wrapper.py", line 51, in get_children File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/http_wrapper/sp_graph_wrapper.py", line 61, in get_children_from_ids File "/home/site/wwwroot/.python_packages/lib/site-packages/backoff/_sync.py", line 105, in retry File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/http_wrapper/http_wrapper.py", line 67, in _get_request File "/home/site/wwwroot/.python_packages/lib/site-packages/msgraph/core/_graph_client.py", line 46, in wrapper File "/home/site/wwwroot/.python_packages/lib/site-packages/msgraph/core/_graph_client.py", line 93, in get File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/sessions.py", line 602, in get File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/sessions.py", line 589, in request File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/sessions.py", line 703, in send File "/home/site/wwwroot/.python_packages/lib/site-packages/msgraph/core/middleware/middleware.py", line 44, in send File "/home/site/wwwroot/.python_packages/lib/site-packages/msgraph/core/middleware/authorization.py", line 20, in send File "/home/site/wwwroot/.python_packages/lib/site-packages/msgraph/core/middleware/authorization.py", line 32, in _get_access_token File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/identity/_internal/get_token_mixin.py", line 86, in get_token File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/identity/_internal/decorators.py", line 84, in wrapper azure.core.exceptions.ClientAuthenticationError: Authentication failed: Could not find a suitable TLS CA certificate bundle, invalid path: /home/site/wwwroot/.python_packages/lib/site-packages/certifi/cacert.pem During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/util/logging.py", line 35, in emit File "/home/site/wwwroot/.python_packages/lib/site-packages/collaborate/util/logging.py", line 68, in post_data File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/api.py", line 115, in post File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/api.py", line 59, in request File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/sessions.py", line 589, in request File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/sessions.py", line 703, in send File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/adapters.py", line 458, in send File "/home/site/wwwroot/.python_packages/lib/site-packages/requests/adapters.py", line 261, in cert_verify OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /home/site/wwwroot/.python_packages/lib/site-packages/certifi/cacert.pem
After this, the function enters the failed state. Having an identical deployment setup for all functions in the App and the problem popping up only during some executions, I find this error hard to explain and resolve. I appreciate your help.