question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Run from Package feature

See original GitHub issue

First, thanks for your work! This was a long awaited Github action and finally we can run both CI and CD workflows in Github 🚀.

If I understand it correctly, currently the Action uses zip deploy strategy where it’s copying files to the /home/site/wwwroot directory on the Function App host machine. This is where the runtime will read files from.

I wonder if you’re planning to add support for Run from package? From what I gather it’s a preferred way to run FAs since it has some advantages (atomicity, faster cold starts, etc) over normal copy-to-home-folder strategy.

Besides, run from package seems to be ON by default when deploying with Azure Functions Core Tools. It’d be great to see consistency among the tools!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:12

github_iconTop GitHub Comments

3reactions
aaronadamsCAcommented, Feb 13, 2021

Oh boy. I’ve been waiting for a while for Linux consumption plans to finally make their way to Canada. Thanks for sharing, I would not have known about this at all! Glad I didn’t get the opportunity to waste my time.

This does seem sadly representative of the state of Azure Functions as a self-serve platform. My functions are written in TypeScript, built with GitHub Actions, and deployed to Azure. It’s a full Microsoft stack, and every day it feels like a mess, with no real signs of hope.

Azure is not for the faint of heart. 😬

3reactions
maximivanovcommented, Feb 12, 2021

Inspired by @aaronadamsCA’s success, I gave it a try and here are the results. Things are definitely not as bright in the Linux land. 😅

Linux Consumption

◉ I created a fresh Function App with WEBSITE_RUN_FROM_PACKAGE=1 app setting. Published the code with the Github Action. All action’s steps succeeded.

Result: code was not deployed. There are no files in the App Files section and no functions in the Functions in the Portal.

In fact, I realized I already opened an issue to update Azure docs to reflect the fact that Linux Consumption does not support WEBSITE_RUN_FROM_PACKAGE=1: https://github.com/Azure/azure-functions-core-tools/issues/2356

◉ I then removed the WEBSITE_RUN_FROM_PACKAGE=1 app setting and ran the Github Action again. All action’s steps succeeded.

Result: the code was deployed. I assume the files were placed directly in the /home/site/wwwroot.

Linux Premium

◉ I created a new Function App with WEBSITE_RUN_FROM_PACKAGE=1 app setting in a EP1 hosting plan. Published the code with the Github Action. All action’s steps succeeded.

Result: code was deployed and WEBSITE_RUN_FROM_PACKAGE=1 was respected. There is a zip file in /home/data/SitePackages as well as a packagename.txt referencing it.

◉ I created a new Function App without WEBSITE_RUN_FROM_PACKAGE=1 app setting in a EP1 hosting plan. Published the code with the Github Action. Run Azure Function action failed with the following error:

Running post deployment command(s)...
Triggering recycle (preview mode disabled).
Deployment successful.
Error: Failed to deploy web package to App Service.
Successfully updated deployment History at https://azfunccdgh-dev-function-app.scm.azurewebsites.net/api/deployments/9fd96845276b354c89a1ddee653c4a2a963babb81613163325529
Error: Execution Exception (state: PublishContent) (step: Invocation)
Error:   When request Azure resource at PublishContent, zipDeploy : Failed to use /home/runner/work/_temp/temp_web_package_33195088267481565.zip as ZipDeploy content
Error:     Package deployment using ZIP Deploy failed. Refer logs for more details.
Error: Deployment Failed!

There was no error description in the referenced logs

Result: despite the error, the code was deployed and worked. I could see files under /home/site/wwwroot. There was no /home/data/SitePackages directory.

I then ran the Action once again and there was no error that time. Not sure what it was.

Summary

Linux Consumption: currently Functions Action deploys directly to the wwwroot folder. It should use WEBSITE_RUN_FROM_PACKAGE=<url> method by default instead (with configuration option to override if needed). Run from package is the recommended deployment method and it is the default in Azure Functions Core Tools.

Linux Premium: currently Functions Action respects the WEBSITE_RUN_FROM_PACKAGE setting. This makes sense. It’s still inconsistent with Azure Functions Core Tools’ defaults (WEBSITE_RUN_FROM_PACKAGE=<url>) though. But that’s probably a part of a bigger discussion of unifying the deployment tooling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run your functions from a package file in Azure - Microsoft Learn
Have the Azure Functions runtime run your functions by mounting a deployment package file that contains your function app project files.
Read more >
How to use Azure Function with Run From Package
A detailed guide on how to setup Azure functions with Azure DevOps using Run From Package.
Read more >
Deploy Web and Function Apps with Run from Package
The way "Run from Package" works is that you simply set up a special App Setting called WEBSITE_RUN_FROM_PACKAGE and its value tells App ......
Read more >
Deploying to App Service that is running from package fails ...
The task became too heavy to manage and we decided to break the tasks. The new tasks are Azure Web App, Azure Web...
Read more >
Deploying App Services with 'Run From Package', Azure ...
Azure App Service recently introduced a feature called Run From Package. Rather than uploading our application binaries and other files to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found