serverless / serverless-azure-functions

Serverless Azure Functions Plugin – Add Azure Functions support to the Serverless Framework
MIT License
266 stars 161 forks source link

Function App not ready? #505

Open Boshskoski opened 3 years ago

Boshskoski commented 3 years ago

This is a Bug Report

Description

When i try sls deploy i get the following output:

Serverless: -> Function App not ready. Retry 0 of 30... Serverless: -> Function App not ready. Retry 1 of 30... Serverless: -> Function App not ready. Retry 2 of 30... Serverless: -> Function App not ready. Retry 3 of 30... Serverless: -> Function App not ready. Retry 4 of 30... Serverless: -> Function App not ready. Retry 5 of 30... Serverless: -> Function App not ready. Retry 6 of 30...

It goes until 30 and after that it is not deployed.

Similar or dependent issues:

I saw the issue with number 409 https://github.com/serverless/serverless-azure-functions/issues/409 but i think that my handler path is not wrong because i am using the quick start project from your serverless examples https://www.serverless.com/framework/docs/providers/azure/guide/quick-start/

and my route paths worked when i tried with serverless offline.

I just created the template, tried the routes with serverless offline and after that sls deploy.

After 30 retries i get the following:

Error --------------------------------------------------

Error: The function app is taking longer than usual to be provisioned. Please try again soon. Response error data: { "value": [], "nextLink": null, "id": null } at FunctionAppService. (C:\LEARNING\AZURE\EXAMPLES\lalal\node_modules\serverless-azure-functions\lib\services\functionAppService.js:204:55) at step (C:\LEARNING\AZURE\EXAMPLES\lalal\node_modules\serverless-azure-functions\lib\services\functionAppService.js:45:23) at Object.next (C:\LEARNING\AZURE\EXAMPLES\lalal\node_modules\serverless-azure-functions\lib\services\functionAppService.js:26:53) at fulfilled (C:\LEARNING\AZURE\EXAMPLES\lalal\node_modules\serverless-azure-functions\lib\services\functionAppService.js:17:58) at processTicksAndRejections (internal/process/task_queues.js:97:5)

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com

Your Environment Information --------------------------- Operating System: win32 Node Version: 12.19.0 Framework Version: 1.80.0 Plugin Version: 3.8.1 SDK Version: 2.3.1 Components Version: 2.34.9

Additional Data

sls --version

Framework Core: 1.80.0 Plugin: 3.8.1 SDK: 2.3.1 Components: 2.34.9

serverless-azure-functions: 2.0.0 node --version: v12.19.0

azure-serverless.zip

bdatdo0601 commented 3 years ago

I run into a similar issue.

The way I resolve this is run sls package, unzip the built zip under .serverless/ then deploy it once via azure-function-core-tools to the same function app. After that sls deploy resolved successfully.

Looking closer, it seems like serverless-azure-functions only try to check readiness but the state from that endpoint does not sync with the actual state of the function app

https://github.com/serverless/serverless-azure-functions/blob/master/src/services/functionAppService.ts (line 101 - 111)

blomm commented 3 years ago

For me, this was a matter of specifying the subscriptionId in the serverless.yml file uncomment it, and provide yours

ianrandell-sh commented 3 years ago

For me, this was a matter of specifying the subscriptionId in the serverless.yml file uncomment it, and provide yours

that doesn't work for me - I already have the subscription id in there

this is causing problems when deploying from github actions since the workflow is deemed failed

bdatdo0601 commented 3 years ago

@ianrandell-sh another thing that I found out is that if you are using node, some certain package might cause issue when FunctionApp trying to zip and unzip the node_modules.

I found out about this when I go to the Function App Portal Console and viewing the FAILED TO DEPLOYMENT.txt

ianrandell-sh commented 3 years ago

@ianrandell-sh another thing that I found out is that if you are using node, some certain package might cause issue when FunctionApp trying to zip and unzip the node_modules.

I found out about this when I go to the Function App Portal Console and viewing the FAILED TO DEPLOYMENT.txt

Ok. I'm using c#/.net functions. I've also noticed that if I drill into the function in the azure portal, it initially doesn't show. However, if I wait eg 5s then refresh it will eventually show. And this plugin will then manage to verify that the function is deployed. Its almost like azure needs a kick of some sort.
I wonder if there's another azure api that can be called to give it that kick.

ianrandell-sh commented 3 years ago

Any other ideas for this? CD from github is constantly marked as failed?

ropeladder commented 3 years ago

I get this same "not ready" loop, and it's similarly because Serverless is not creating any functions within my Function App. But in my case it's not creating any because it's not packaging them, and it's not packaging them because it's not finding them at all... and never throwing an error (!?).

denied173 commented 3 years ago

I'm having the same issue! But I've found out it depends somehow on the version of NPM you are using. My service deployment fails if I install my dependencies using NPM 7.5.4 with exactly that deploy loop "Function App not ready. Retry 0 of 30..." and otherwise succeeds when installing all dependencies using NPM 6.14.11. I don't know if it helps at this point, but this is the thing I noticed after having trouble with this issue nearly one week.

jorenvh1 commented 3 years ago

Having the same issue. None of the options above are working.

jorenvh1 commented 3 years ago

Ok, I figured out what the problem was in my case. At November Five (The company I work for) we have always used AWS for serverless deployments. For a specific project we are now using azure. I did however use roughly the same serverless.yml file we use for AWS deployments apart from the obvious azure specific properties ("subscriptionId", "resourceGroup", ...)

After not being able to properly deploy I tried to run a deployment starting from a fresh serverless-azure boilerplate and noticed that some things in the deployement package are quite different.

The exact problem I had was the fact that under the "package" property (inside serverless.yml) we used to exclude everything and only include a few specific folders and files. The big difference is that for azure, a folder is create for each function as well as a few azure specific files which are added ('host.json',...). You really need to make sure these are included in the package for the deployment to be successful.

If you want to double check if everything is in there, you can run "sls package" and look inside the zip created in the .serverless folder.

Would be nice to have some specific error messages for this though. Because it looks like a few mistakes inside the serverless.yml file could result in a failed deployment.

danuker commented 2 years ago

The way I resolve this is run sls package, unzip the built zip under .serverless/ then deploy it once via azure-function-core-tools to the same function app. After that sls deploy resolved successfully.

Thank you @bdatdo0601 , MS's tools showed me that Azure Functions requires a requirements.txt file.

I had tried to adapt a project which was using Poetry and was missing it, and the serverless-azure-functions plugin kept me in the dark.

psamusev commented 2 years ago

@bdatdo0601 it helps to not more see the Function App not ready. Retry 0 of 30... however, if you modify your function code and try to deploy it again with sls deploy command you won't see updates to be applied. The only way to update it again, use azure-function-core-tools for deployment and sls package to packaging

I'm using linux os and runFromBlobUrl: true deployment config - to run install step directly in cloud

UPDATE: It got updated but not immediately and rather after some time. And in general deploy took almost 3-4 minutes, which is of course too slow

lucasrestrepo commented 2 years ago

HI we are having the same issue either deploying from a GitHub runner or local. the problem we are facing is when we use the sis deploy command to azure none of the functions get deployed to the function app. I have tried to troubleshoot but I can see no messages related to the problem and the output of the commands don't show any indication of the problem. today we deployed the code using az commands and after that we deploy using sis deploy and it worked so I think the problem is related to the firs time Serverless is deployed to azure. once the functions show up on the cloud they cam be updated after that.

almiavicas commented 1 year ago

This is still an issue. Follow the comments on this ticket to solve your issue! The one from @bdatdo0601 helped me.

lcsales98 commented 1 year ago

Are you deploying a Linux or Windows Function? I'm not sure yet but i think this problem is related to 2 settings WEBSITE_CONTENTSHARE and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING. To know more about: https://learn.microsoft.com/en-us/azure/azure-functions/functions-recover-storage-account#storage-account-application-settings-were-deleted