Unsupported Zip format or corrupted zip file

srvedroom 96 Reputation points
2021-12-03T11:44:16.983+00:00

Hi!

I was trying to publish azure function app via cli to Azure, unfortunately it's not working as I expect

Azure Functions Core Tools: 3.0.3785-1
Host: Windows
Runtime: Node 12
FUNCTIONS_EXTENSION_VERSION: ~3
FUNCTIONS_WORKER_RUNTIME: node
WEBSITE_NODE_DEFAULT_VERSION: ~12
WEBSITE_RUN_FROM_PACKAGE: 1

Here's the output I'm gettings:

Getting site publishing info...
Creating archive for current directory...
Uploading 334.73 MB []Upload completed successfully.
Deployment completed successfully.
Syncing triggers...
Syncing triggers...
Functions in ***-weur-prod-***:

In console I can find "FAILED TO INITIALIZE RUN FROM PACKAGE.txt" which contains:
Run From Package Initialization failed. Unsupported Zip format or corrupted zip file.
This could be a leftover from previous runs as I was trying to use core tools v4

When I got and check /home/data/SitePackages I can find my zip file and packagename.txt containning the file name
Checking the zip file with unzip -t <filename> gives the following

    ...
    testing: webhook/function.json    OK
No errors detected in compressed data of 20211203064756.zip.

Is there anything else I could check?
I've also published this question on Azure Functions Core Tools github (https://github.com/Azure/azure-functions-core-tools/issues/2856), but I'm currently trying to solve it via Azure UI

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,932 questions
0 comments No comments
{count} votes

Accepted answer
  1. srvedroom 96 Reputation points
    2021-12-07T13:58:28.083+00:00

    Seems it was something to do with the zip package size
    I've reduced the overall size of zip from 300MB to ~100MB using .funcignore and suddenly all the functions got deployed as expected

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2021-12-06T12:01:53.857+00:00

    @srvedroom ,

    Thanks for reaching out to Q&A.

    I just have a couple of questions and suggestions.

    Have you made any previous deployments and did those deployment work as expected? If there were deployments earlier and it was working. Then the functions might be picking the wrong zip package from the sitepackage folder. To fix this, under app settings add “WEBSITE_DISABLE_ZIP_CACHE” with value as 1.

    The "FAILED TO INITIALIZE RUN FROM PACKAGE.txt" error could also be caused if the Storage account where the package was deployed is not accessible due to firewall or network restriction. Also if you are passing a SAS url in the WEBSITE_RUN_FROM_PACKAGE app setting, please check if the SAS url is not expired or its a valid url.

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.