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:
- Number of entries expected in End Of Central Directory does not correspond to number of entries in Central Directory
- https://learn.microsoft.com/en-us/answers/questions/1462401/azure-functions-deployment-error-number-of-entries
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:
- https://learn.microsoft.com/en-us/answers/questions/1164071/vs-code-deployment-error-offset-to-central-directo
- Offset to Central Directory cannot be held in an Int64
- https://github.com/projectkudu/kudu/issues/3348
- https://learn.microsoft.com/en-us/answers/questions/1462400/error-while-deploying-a-function-on-azure-through
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:
- https://github.com/microsoft/Oryx/issues/1774
- Azure Function Deployment Successful but Triggers are not synchronized
- https://github.com/microsoft/vscode-azurefunctions/issues/2529
- https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python?pivots=python-mode-decorators#update-app-settings
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 get the azure account tenant Id?
Follow this path: Microsoft Entra ID > Default Directory > Properties
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:
3
Answers
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 Function Version: 1.12.4
Azure Resource Version: 0.8.0
#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:
Requirements:
After these 2 were solved I was able to deploy directly from VS code.
I faced the same issues when I was trying to deploy the Python V2 Function to Azure with the packages:
I have replicated the same in my environment as below:
requirements.txt:
local.settings.json:
func azure functionapp publish <functionapp_name>
Console Response:
Portal:
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
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