pythonpython-3.xazure-functions

The underlying compression routine could not be loaded correctly error when deplying Function App


Tried running in vs code this command:

func azure functionapp publish [the function app name]

got this output:

Getting site publishing info...
[2025-04-23T12:26:20.365Z] Starting the function app deployment...
Creating archive for current directory...
Performing remote build for functions project.
Deleting the old .python_packages directory
The underlying compression routine could not be loaded correctly.

Validations

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         4/22/2025   9:56 PM                .vscode
-a----         4/21/2025  11:12 AM            517 .gitignore
-a----         4/21/2025  10:06 PM            391 additional_functions.py
-a----         4/22/2025  10:11 PM            560 function_app.py
-a----         4/21/2025  11:12 AM            302 host.json
-a----         4/22/2025   6:13 PM            206 local.settings.json
-a----         4/22/2025   9:39 PM            207 requirements.txt
{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.*, 5.0.0)"
  }
}
{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsFeatureFlags": "enableWorkerIndexing",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true"
  }
}

azure-functions

Environment Variables
APPLICATIONINSIGHTS_CONNECTION_STRING
AzureWebJobsFeatureFlags
AzureWebJobsStorage
FUNCTIONS_EXTENSION_VERSION
FUNCTIONS_WORKER_RUNTIME
az --version
azure-cli                         2.71.0
core                              2.71.0
telemetry                          1.1.0
Dependencies:
msal                            1.31.2b1
azure-mgmt-resource               23.1.1

Solution

  • The underlying compression routine could not be loaded correctly.

    The error occurs due to issues with the Azure Functions Core Tools installation when installed via the Windows installer.

    To resolve the issue, reinstall the Azure Functions Core Tools using npm instead of the Windows installer. The below command makes sure the tools are installed.

    npm install -g azure-functions-core-tools@4 --unsafe-perm true
    

    After reinstalling with npm, re-run the deployment command below.

    func azure functionapp publish <FunctionAppName>