Solved: Azure Functions There is not enough space on the disk

Overview

Azure Function Apps allow developers to build and deploy event-driven applications in the cloud. However, as with any software we can sometimes run into unusual issues, in particular, I recently ran into the below error when trying to deploy an Azure Function App through a GitHub Actions CICD pipeline.

If you have also encountered this issue, then you are in luck, because in this article we’ll explore the cause of this error and how I solved the issue.

“Internal Server Error (CODE: 500)”

“There is not enough space on the disk.”


Solution

As you probably already know, the Azure function App host comes with a specific storage size, depending on the hosting plan you’ve selected. In my case, I was using the consumption model. You can find more information here at the below link:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits

The above error message suggests, there is not enough space available on the local host to deploy the Function App code. So we need to delete any temporary files on the underlying host.

Solution 1 – Restart

The first thing to try is to restart the Azure function and re-run the deployment again. In some cases this may solve the issue for you, as the temporary files should be automatically cleared on the underlying host upon restart. Whilst this solution worked for me temporarily, I again encountered the same error soon after.

Solution 2 – Remove Temporary Files

Fortunately, the permanent solution was relatively simple and involved removing the temporary files from the below directories through Kudu:

  • “C:\home\site\deployments” – Contains the previous deployment history
  • “C:\home\site\wwwroot” – Contains extracted files from the deployment package

To access Kudu, open the Function App resource in the Azure Portal and navigate to DEVELOPMENT TOOLS > ADVANCED TOOLS. Click “Go”. This will take you to the Kudu dashboard.

Here you can view your current disk space usage in the ‘System Info’ section of the ‘Environment’ page.

Kudu System Info

To delete the temporary files, navigate to the “Debug Console” dropdown and select “CMD”. From there, navigate to the “site/wwwroot” folder. Delete all of the files in this folder. Next, navigate to the “deployments” folder and do the same thing.

After doing this, I then re-ran the Function App deployment, and this time it ran successfully, without any issues.

Kudu Screenshot

Alternatively, you can also install the ‘Disk Usage’ extension on your Web App resource. This extension will provide a breakdown of the disk space used by folder. Very handy!


Final Thoughts

Well, I hope this solution has helped you resolve the issue for you as well.

If you find any other alternative solutions, then feel free to share them in the comments below to help others out there. Happy coding 🙂

Shane Bartholomeusz

Leave a Reply