skip to Main Content

I am trying to deploy a function app from VS code into Azure.

Each time I attempt to deploy, I receive this stack:

2:48:04 PM xxxx: Verifying that app settings have propagated... (Attempt 1/12)
2:48:06 PM xxxx: Starting deployment...
2:48:06 PM xxxx: Creating zip package...
2:48:06 PM xxxx: Zip package size: 14.7 kB
2:48:19 PM xxxx: Fetching changes.
2:48:20 PM xxxx: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/2e4c7760-ec95-404f-81f5-9b373121bb6b.zip (0.03 MB) to /tmp/zipdeploy/extracted
2:48:20 PM xxxx: **Number of entries expected in End Of Central Directory does not correspond to number of entries in Central Directory.**
2:48:34 PM xxxx: Deployment failed.

Here’s what is strange:

The same exact code works when I deploy it to Azure from VS Code when the function App is behind a consumption tier, but spit of the error above on the premium tier.

I have looked through other articles, and cannot find a solution to the problem.

Related Forums:

One article mentions to install Azure Function version 1.12.4, after which the stack becomes

7:31:39 PM xxxx: Starting deployment...
7:31:40 PM xxxx: Creating zip package...
7:31:40 PM xxxx: Zip package size: 19.7 kB
7:31:46 PM xxxx: Fetching changes.
7:31:48 PM xxxx: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/9530b5ab-378f-45e5-81f8-960e490dd5f6.zip (0.02 MB) to /tmp/zipdeploy/extracted
7:31:48 PM xxxx: **Offset to Central Directory cannot be held in an Int64**.
7:31:54 PM xxxx: Deployment failed.

I have also looked through articles related to this error and cannot find a solution.

Related Forums:

Does anyone have any ideas or suggestions?

In summary, I tried

  • Restarting the function
  • Stopping then starting function App
  • Changing Azure Function Version
  • Creating a Brand new Function
  • Change Azure Function Tier
    I expected the deployment to be successful

Update #1:

I used VSCode Function App Extenstion Version 1.13.0 and the deployment went through but now the functions don’t show up in the Azure Portal.

This is the end of the stack:

7:59:39 PM xxxx: Deployment successful. deployer = ms-azuretools-vscode deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
8:00:03 PM xxxx: Syncing triggers...
8:00:19 PM xxxx: Querying triggers...
8:00:28 PM xxxx: No HTTP triggers found.

I experienced this in the past when I declared local variables in the script of the function app, removing those while using Function App Extension 1.13.1 AND a function app on a premium version solved the problem. I will be reviewing and will update if I find a solution. What a pain in the neck!?

Here are some related articles:

Update #2:
Interestingly enough, when I add a try block on the importing of the packages I receive this new error: Number of entries expected in End Of Central Directory does not correspond to number of entries in Central Directory which makes me think the root of issue has to due with the package dependencies.

Update #3:
I noticed one of the libraries I imported "os" was greyed out, so I removed it, and the error went away. After 5 minutes of deploying I received the following stacktrace:

8:24:08 PM xxxx: Syncing triggers...
8:25:04 PM xxxx: Syncing triggers (Attempt 2/6)...
8:25:21 PM xxxx: Syncing triggers (Attempt 3/6)...
8:25:43 PM xxxx: Syncing triggers (Attempt 4/6)...
8:26:23 PM xxxx: Syncing triggers (Attempt 5/6)...
8:27:44 PM xxxx: Syncing triggers (Attempt 6/6)...
8:28:34 PM: Error: Encountered an error (ServiceUnavailable) from host runtime.

Update #4:

After restarting the function app, I now get this error.

8:38:39 PM xxxx: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/0321ff98-e4cb-4baf-bf3d-829aa0cea78f.zip (0.00 MB) to /tmp/zipdeploy/extracted
8:38:39 PM xxxxx: Central Directory corrupt.
8:38:53 PM xxxxx: Deployment failed.

This is insane how difficult it is to deploy a simple code. There has to be reasonable solution that does not require chasing error after error….

Update #5:

I tried deploying using Azure Core Tools. I get a Success message, however the function are missing in the portal. Noting I deployed the sample function Azure/VS Code provides.

More details on how to deploy using core tools below.

Deploying Azure function
https://learn.microsoft.com/en-us/powershell/azure/install-azps-windows?view=azps-11.1.0&tabs=powershell&pivots=windows-psgallery

Connect-AzAccount -Tenant "xxxxxxxx" -SubscriptionId "xxxxxxxxx"

How to find Tenant ID

How to find Subscription ID
https://learn.microsoft.com/en-us/azure/azure-portal/get-subscription-tenant-id
Follow this path: Subscriptions

func azure functionapp publish

Update #6:

This article suggested version changes on some extension in VS Code: https://learn.microsoft.com/en-us/answers/questions/1462400/error-while-deploying-a-function-on-azure-through?comment=answer-1391559&page=1#comment-1459936

I applied the changes but it results in 8:52:55 AM: Error: Encountered an error (InternalServerError) from host runtime, even after restarting the function multiple times.

Here is my local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "xxxx",
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsFeatureFlags": "EnableWorkerIndexing"
  }
}

Here is my import statement of the libraries:

azure-functions
pyodbc
requests
uuid

Here is my import statement of the libraries:

import statements

3

Answers


  1. Chosen as BEST ANSWER

    I want to share what worked for me.

    #1 Install the following extension versions. Thanks to JananiRamesh-MSFT in this thread: https://learn.microsoft.com/en-us/answers/questions/1462400/error-while-deploying-a-function-on-azure-through?page=1&orderby=Helpful&comment=answer-1391559#newest-answer-comment

    Azure App Service Version: 0.25.0

    Azure App Service Version

    Azure Function Version: 1.12.4

    Azure Function Version

    Azure Resource Version: 0.8.0

    Azure Resource Version

    #2 Pay careful attention to the importing of libraries and requirements.txt. I was using uuid but the requirements.txt needs to have uuid0. I have no clue why but Pravallika KV pointed this out.

    Import:

    import azure.functions as func
    import logging
    try:
        import pyodbc
        import json
        import uuid
        import requests
        from concurrent.futures import ThreadPoolExecutor
        from datetime import datetime
        import traceback  # Import the traceback module
        import time
        import random
    except:
        pass
    

    Requirements:

    azure-functions
    pyodbc
    requests
    uuid0
    

    After these 2 were solved I was able to deploy directly from VS code.


  2. I faced the same issues when I was trying to deploy the Python V2 Function to Azure with the packages:

    azure-functions
    pyodbc
    uuid
    requests
    

    I have replicated the same in my environment as below:

    • Created a Python V2 Http Triggered Azure Function.

    requirements.txt:

    azure-functions
    pyodbc
    uuid0
    requests
    

    local.settings.json:

    {
      "IsEncrypted": false,
      "Values": {
        "FUNCTIONS_WORKER_RUNTIME": "python",
        "AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
        "AzureWebJobsStorage": "<Storage_connection_string>"
      }
    }
    
    • Added the below application settings in Azure Function App’s Configuration in portal.
    SCM_DO_BUILD_DURING_DEPLOYMENT = true
    AzureWebJobsFeatureFlags = EnableWorkerIndexing
    
    • Deployed the function to Premium Azure Function App successfully using Azure Function Core Tools with the command:
      func azure functionapp publish <functionapp_name>

    Console Response:

    C:Users<username>kpyv2fn>func azure functionapp publish functionappname
    Getting site publishing info...
    [2023-12-14T12:23:22.451Z] Starting the function app deployment...
    Creating archive for current directory...
    Performing remote build for functions project.
    Deleting the old .python_packages directory
    Uploading 2.37 KB [###############################################################################]
    Remote build in progress, please wait...
    Updating submodules.
    Preparing deployment for commit id '5ec0XX2-c'.
    PreDeployment: context.CleanOutputPath False
    PreDeployment: context.OutputPath /home/site/wwwroot
    Repository path is /tmp/zipdeploy/extracted
    Running oryx build...
    Command: oryx build /tmp/zipdeploy/extracted -o /tmp/build/expressbuild --platform python --platform-version 3.11 -i /tmp/8dbfc9f7e1ada4c -p packagedir=.python_packages/lib/site-packages
    Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
    You can report issues at https://github.com/Microsoft/Oryx/issues
    
    Oryx Version: 0.2.20230508.1, Commit: 7feXXXXXXXXXXXXXXXXXXX4592, ReleaseTagName: 20230508.1
    
    Build Operation ID: 19XXXXXXXXXXXbb5
    Repository Commit : 5ec05XXXXXXXXXXXXXXXXXXX9ae36591
    OS Type           : bullseye
    Image Type        : githubactions
    
    Detecting platforms...
    Detected following platforms:
      python: 3.11.6
    
    Using intermediate directory '/tmp/8dbfc9f7e1ada4c'.
    
    Copying files to the intermediate directory...
    Done in 0 sec(s).
    
    Source directory     : /tmp/8dbfc9f7e1ada4c
    Destination directory: /tmp/build/expressbuild
    
    Python Version: /tmp/oryx/platforms/python/3.11.6/bin/python3.11
    Creating directory for command manifest file if it does not exist
    Removing existing manifest file
    
    Running pip install...
    Done in 3 sec(s).
    [12:23:42+0000] Collecting azure-functions
    [12:23:42+0000]   Using cached azure_functions-1.17.0-py3-none-any.whl (165 kB)
    [12:23:42+0000] Collecting pyodbc
    [12:23:42+0000]   Using cached pyodbc-5.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (344 kB)
    [12:23:42+0000] Collecting uuid0
    [12:23:42+0000]   Using cached uuid0-0.2.7-py2.py3-none-any.whl (9.3 kB)
    [12:23:42+0000] Collecting requests
    [12:23:42+0000]   Downloading requests-2.31.0-py3-none-any.whl (62 kB)
    [12:23:42+0000] Collecting pybase62
    [12:23:42+0000]   Using cached pybase62-1.0.0-py3-none-any.whl (4.9 kB)
    [12:23:42+0000] Collecting idna<4,>=2.5
    [12:23:42+0000]   Downloading idna-3.6-py3-none-any.whl (61 kB)
    [12:23:43+0000] Collecting charset-normalizer<4,>=2
    [12:23:43+0000]   Downloading charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
    [12:23:43+0000] Collecting certifi>=2017.4.17
    [12:23:43+0000]   Downloading certifi-2023.11.17-py3-none-any.whl (162 kB)
    [12:23:43+0000] Collecting urllib3<3,>=1.21.1
    [12:23:43+0000]   Downloading urllib3-2.1.0-py3-none-any.whl (104 kB)
    [12:23:43+0000] Installing collected packages: urllib3, pybase62, idna, charset-normalizer, certifi, uuid0, requests, pyodbc, azure-functions
    [12:23:43+0000] Successfully installed azure-functions-1.17.0 certifi-2023.11.17 charset-normalizer-3.3.2 idna-3.6 pybase62-1.0.0 pyodbc-5.0.1 requests-2.31.0 urllib3-2.1.0 uuid0-0.2.7
    WARNING: You are using pip version 21.2.4; however, version 23.3.1 is available.
    You should consider upgrading via the '/tmp/oryx/platforms/python/3.11.6/bin/python3.11 -m pip install --upgrade pip' command.
    Not a vso image, so not writing build commands
    Preparing output...
    
    Copying files to destination directory '/tmp/build/expressbuild'...
    Done in 0 sec(s).
    
    Removing existing manifest file
    Creating a manifest file...
    Manifest file created.
    Copying .ostype to manifest output directory.
    
    Done in 3 sec(s).
    Writing the artifacts to a Zip file
    Running post deployment command(s)...
    
    Generating summary of Oryx build
    Deployment Log file does not exist in /tmp/oryx-build.log
    The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
    Triggering recycle (preview mode disabled).
    Deployment successful. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
    Remote build succeeded!
    

    Portal:

    enter image description here

    Login or Signup to reply.
  3. I am able to reproduce the issue at my end I am checking with internal team on this and will update you here once I hear back from them.

    Meanwhile try decreasing the version of Azure Resource extension,

    Following settings worked for me:

    Azure Resources -> v0.8.0

    enter image description here

    refernce threads: https://learn.microsoft.com/en-us/answers/questions/1462400/error-while-deploying-a-function-on-azure-through

    https://learn.microsoft.com/en-us/answers/questions/1462401/azure-functions-deployment-error-number-of-entries

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search