Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.3k stars 431 forks source link

Deploy function with Python code from VS code - AzureWebJobsStorage error #3158

Open hungchun-lin opened 1 year ago

hungchun-lin commented 1 year ago

Hi, I created a function from local, and about to deploy, I used the deploy button from WORKPLACE, and got error: After python packages got installed: 4:53:51 PM liborwebapi: Preparing output... 4:53:51 PM liborwebapi: Copying files to destination directory '/home/site/wwwroot'... 4:53:51 PM liborwebapi: Done in 0 sec(s). 4:53:51 PM liborwebapi: Removing existing manifest file 4:53:51 PM liborwebapi: Creating a manifest file... 4:53:51 PM liborwebapi: Manifest file created. 4:53:51 PM liborwebapi: Done in 7 sec(s). 4:53:52 PM liborwebapi: Running post deployment command(s)... 4:53:52 PM liborwebapi: Generating summary of Oryx build 4:53:52 PM liborwebapi: Deployment Log file does not exist in /tmp/oryx-build.log 4:53:52 PM liborwebapi: The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build 4:53:52 PM liborwebapi: Triggering recycle (preview mode disabled). 4:53:52 PM liborwebapi: Linux Consumption plan has a 1.5 GB memory limit on a remote build container. 4:53:53 PM liborwebapi: To check our service limit, please visit https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits 4:53:53 PM liborwebapi: Creating placeholder blob for linux consumption function app... 4:53:53 PM liborwebapi: Malformed SCM_RUN_FROM_PACKAGE when uploading built content. 4:53:53 PM liborwebapi: Generating summary of Oryx build 4:53:53 PM liborwebapi: Deployment Log file does not exist in /tmp/oryx-build.log 4:53:53 PM liborwebapi: The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build 4:53:53 PM liborwebapi: Deployment Failed. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build. 4:53:56 PM liborwebapi: Deployment failed.

and I also tried to use command: func azure functionapp publish <functionAppName> --build remote and got the error: app is missing AzureWebJobsStorage app setting. That setting is required for publishing consumption linux apps.

I tried to solve this error by changing the "AzureWebJobsStorage": "" to "AzureWebJobsStorage": "UseDevelopmentStorage=true" but still failed.

ahenaor commented 1 year ago

I have exactly the same problem.

ahenaor commented 1 year ago

hi @hungchun-lin I solve my problem by setting the CONNECTOR STR of the storage in my variables file, specifically under the "AzureWebJobsStorage" variable -- Application settings.

hope this helps you

hungchun-lin commented 1 year ago

Hi @ahenanor, Thanks for your reply! I have tried this before, I can finally deploy my function, but the function would not work in the cloud. After struggling for a few days, I deleted all sources, app in the cloud, and restarted everything, then I can successfully just click the deploy button to deploy my function.

paulyuk commented 1 year ago

Hi @hungchun-lin - when you were working locally, did you have "AzureWebJobsStorage": "UseDevelopmentStorage=true" in the local.settings.json file only, but not in hosts.json? I believe the expected model for this is your local settings go in local.settings.json and that's where you use the emulator. In the cloud you'd use what's in hosts.json, and likely would point to a real Azure Storage Account resource.

Also could you clarify when things worked locally did you use Azurite as an emulator? https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio

Note I just barely made a proposal to #3176 to make this all easier, and would love your feedback on that in that issue if you have time.

ejizba commented 1 year ago

Hi @paulyuk, the local.settings.json and host.json files are completely different. host.json applies both locally and remote. local.setting.json is local-only and corresponds to your app settings when running remote (there is no file for this in the remote scenario because app settings often contain sensitive data and you wouldn't want that in a file).