Azure / functions-action

Enable GitHub developers to deploy to Azure Function Apps using GitHub Actions
MIT License
152 stars 75 forks source link

Deploy action is not deploying anything #192

Closed alexbruno closed 10 months ago

alexbruno commented 1 year ago

Deploy action is resolving as success but nothing is actually deployed. The application is not working and by checking it at Azure through FTPS I see nothing in /site/wwwroot/ dir, it is empty.

github-actions[bot] commented 1 year ago

This issue is idle because it has been open for 14 days with no activity.

patelchandni commented 1 year ago

@alexbruno, I need more information to investigate.

  1. Please share your .yaml workflow.
  2. Your function app is on which OS and SKU?
  3. Is "package" parameter for this action pointing to right location?
alexbruno commented 1 year ago

Thanks for the response @patelchandni ! I'm not running any functions now, but I'm gonna run some new tests and give you feedback here in this thread.

github-actions[bot] commented 1 year ago

This issue is idle because it has been open for 14 days with no activity.

mildronize commented 10 months ago

I've also found the same problem.

benboit commented 10 months ago

Hello,

im facing the same issue.

Function was

After the first 2 steps i have a function up and running. When i do a deployment using github actions, i dont get any error, but the code of the function stays the same.

Run Azure/functions-action@v1.5.1 Successfully parsed SCM credential from publish-profile format. Using SCM credential for authentication, GitHub Action will not perform resource validation. (node:1855) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Usenode --trace-deprecation ...to show where the warning was created) Successfully acquired app settings from function app (with SCM credential)! Will archive ./XXXX into /home/runner/work/_temp/temp_web_package_9668278850995906.zip as function app content Will use Kudu https://<scmsite>/api/zipdeploy to deploy since publish-profile is detected. Setting SCM_DO_BUILD_DURING_DEPLOYMENT in Kudu container to false Update using context.kuduService.updateAppSettingViaKudu Response with status code [20](https://github.com/XXXX/actions/runs/6651109086/job/18072484926#step:6:21)4 App setting SCM_DO_BUILD_DURING_DEPLOYMENT propagated to Kudu container Setting ENABLE_ORYX_BUILD in Kudu container to false Update using context.kuduService.updateAppSettingViaKudu Response with status code 204 App setting ENABLE_ORYX_BUILD propagated to Kudu container Package deployment using ZIP Deploy initiated. Deploy logs can be viewed at https://XXXX.scm.azurewebsites.net/api/deployments/ac3811bc7de84b0b8ac54a0e[23](https://github.com/XXXX/actions/runs/6651109086/job/18072484926#step:6:24)7698d1/log Successfully deployed web package to App Service. Deleting SCM_DO_BUILD_DURING_DEPLOYMENT in Kudu container Response with status code 204 Deleting ENABLE_ORYX_BUILD in Kudu container Response with status code 204

As you can see im already using the newest action. I already spent a lot of time into trying to make this work. I dont have any more ideas.

alexbruno commented 10 months ago

I'm now able to deploy functions. Here are the steps I've used:

      - name: Run Azure Functions Action
        uses: Azure/functions-action@v1
        with:
          slot-name: Production
          app-name: ${{ env.APP_NAME }}
          package: ${{ env.PACKAGE_PATH }}
          publish-profile: ${{ secrets.AZURE_FUNCTION_APP_PROFILE }}
benboit commented 10 months ago

@alexbruno Have you checked if it really works or only deploys? For me it looked working, but didnt.

alexbruno commented 10 months ago

@alexbruno Have you checked if it really works or only deploys? For me it looked working, but didnt.

Yes, working, running an enterprise serverless API in production.

It is possible to check if the functions are online in the Function App initial page.

*Edit: Some more important hints:

  1. By default, the Function App runs any of your functions under the /api/ path. If you don't setup anything different, all of your function names will run after that. (Ex.: domain.com/api/function-name)
  2. If your code needs any kind of build/compilation step before deploy, be sure the result code does not require any other dependency after build, or you may deploy the dependency along the production code.
benboit commented 10 months ago

@alexbruno how did you setup the function in detail? Windows or linux? Is a deployment slot mandatory (i dont have any).

My new tests failed with not enough space when setting up the function with defaults. Stripping the node_modules folder and then trying again to deploy leads to a generic error, that the zip is not processable.

alexbruno commented 10 months ago

@benboit , the docs are not clear about a lot of things over all the Azure services and features! For most of them we need to discover how to do it right by ourselves.

If you try to deploy your app with everything into it, including package dependencies, you may face that "not enough space" error. So that is my solution for my case:

  1. I'm coding my app with TypeScript, so I have a build step to produce the final code.
  2. I run every build steps before execute the functions-action to deploy.
  3. I use esbuild to bundle everything in just one .js file with tree-shaking and optimizations to a dist dir.
  4. I'm excluding the Azure packages from the bundle, treating them as external packages.
  5. So, I copy a bare simple version of my package.json into the dist dir, listing only the Azure packages as dependencies.
  6. Then I run npm install inside the dist dir to pack the depencies for deployment.
  7. Finally, I run the functions-action to deploy only the content inside the dist dir.

By doing things this way I could properly deploy my Function App.

Here is my tiny package.json for my built package:

{
  "main": "app.js",
  "name": "function-app",
  "dependencies": {
    "@azure/functions": "latest",
    "@azure/storage-blob": "latest"
  }
}
technokarthyk commented 8 months ago

hi i'm facing an issue, my github actions workflow, both build and deploy got success without an error but while i check on azure portal my function app is not displaying and i am trying to push from organization repo i dont know how to resolve this can anyone help me

Libre255 commented 7 months ago

im facing same issue. Im trying to deploy a ASP.NET API with docker image. When i deploy a React docker image it works but it doesnt work with ASP.NET API docker image even though the workflow says "successfull deployed"

- uses: azure/webapps-deploy@v2 with: app-name: testga-bv publish-profile: ${{ secrets.AZURE_WEBB_PUBLISH_PROFILE }} images: | docker.io/<image name>

i tried running my api docker image locally and it worked without problem.