azure-functions-dotnet-worker: Required .azurefunctions directory is not created when publishing from a GitHub workflow on an ubuntu runner
This is similar to issue 741. That was closed because the op couldn’t reproduce it later, but it’s a current issue for me.
When dotnet publish runs on my computer, the publish output contains a folder named .azurefunctions, but when the same commands are run on an ubuntu GitHub runner, that folder is missing. I haven’t noticed any other differences. In both cases there is a file named extensions.json which contains references to the .azurefunctions folder, so it seems like the folder is expected to be there.
Deploying the app from my computer’s build (which has that folder) runs fine in Azure. Deploying the one built on the GitHub runner (which does not) gets “No job functions found. Try making your job classes and methods public” errors, and the app doesn’t work.
The project is an isolated process function app for .NET 7. In both cases I’m using the .NET SDK version 7.0.100.
I’m happy to provide any logs or other diagnostics.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 20 (2 by maintainers)
if anyone had this kind of issue with GitHubPipeline upload artifact below options should be used.
include-hidden-files: true
Apologies for barging in but for info I’ve had the same problem with a GitLab CD pipeline. Issue is described as above and 24 hours of banging my head against the wall and googling landed me here!
As @fabricciotc suggested, the solution for me was to force include
.azurefunctionsin the zip command:zip -r /deploy.zip * .azurefunctionsThe symptom for me was that the function app started but no functions were listed. A push deploy from Rider worked, but the CD pipeline did not. Hope this helps other people who may stumble upon this too.
Yes, you’ve correctly identified the issue. The problem lies in using
Compress-Archiveto generate the artifact. While it works correctly on Windows, on Linux, files and folders starting with a dot (such as the.azurefunctionsfolder) are considered hidden files and are not automatically added to the archive. As a result, when you deploy the artifact, the missing.azurefunctionsfolder leads to an invalid Azure Function.To address this, you can modify your approach by explicitly including the
.azurefunctionsfolder in the archive creation process. One possible solution is to use theGet-ChildItemcommand to retrieve all files and folders, including hidden ones, and then pass them toCompress-Archivefor compression.One possible solution is to use the following code:
I think I’ve tracked down my issue, which is the
.azurefunctionsfolder does get generated. However, it is not in the.zipartifact.In my case this is because I was using
Compress-Archiveto generate the artifact. Which works correctly on windows, however on linux these are interpreted as hidden files and are not added to the archive. This results in an invalid az function when deployed.Also see: https://github.com/PowerShell/Microsoft.PowerShell.Archive/issues/66
After lots of googling - this is the answer!
Our CI/CD pipeline runs on a linux agent and this folder (.azurefunctions) is excluded from the generated zip file intermittently. (have to run the pipeline more than once for it to appear).
Much obliged @daniellittledev and @fabricciotc! I had the same setup and overlooked this…
Thank you, It work when add
include-hidden-files: true. I’m using https://github.com/actions/upload-artifact/releases/tag/v3.2.1Your comment helped me out, thank you! Looks like v4.4.0 had breaking changes and seems
include-hidden-files: trueis required if you’re building artifacts for Azure Functions: https://github.com/actions/upload-artifact/releases/tag/v4.4.0You are a hero. Thank you!