Failed to deploy Flask app to Azure Web App services using GitHub Actions

Jyosna Philip 20 Reputation points
2024-06-14T08:34:21.16+00:00

I am new to Azure, and I have a small flask app the source code of which is on https://github.com/jyosnaphilip/predictive-maintenance-app/

I have a student subscription and i tried to deploy it in the deployment center using github actions.

This is the error that is shown in GitHub:

deployFailed to deploy web package to App Service.**deployFailed to deploy web package to App Service.deploy**Deployment Failed, Package deployment using ZIP Deploy failed. Refer logs for more details.Run azure/webapps-deploy@v2

2 with:

3 app-name: predictivemaintenance30daysml

4 slot-name: Production

5 publish-profile: ***

6 package: .

7Package deployment using ZIP Deploy initiated.

8Error: Failed to deploy web package to App Service.

9Error: Deployment Failed, Error: Failed to deploy web package to App Service.

10Conflict (CODE: 409)

11App Service Application URL: https://predictivemaintenance30daysml.azurewebsites.net

In the app deployment center Logs i see the following error, i dont know why i'm unable to read this:

Failed to load log activity: ��X[o�6~ϯ��&"�g�Lb�&.6�63����iA��34�!)�ޢ�}���[����.��>j�����ï'$�31>6�l|@�o�&�C�
�*��!�b�ʒ�Iլ��'\p�$3��<�<�ɏ%+	�%Z}�I�<S�Xp��h���J۴���J�.|F3�a�.�0���s�?�ǻ�}5���X�N�E_J>�
�
�k�h�� �(����e�*P�J:C�sOZ���ę�GP*��s�
�bi������V���?�rU��#�������R��lk�u%6��Kq��5V�"D��͸�RcYX��?7�T����.3��ď_J�Kdu�<�G��qE�+uN�G����`S�U�Ŗ�����1.�Ъₜ���e��{�3�L�5�Hx�sZ���E�	�&#����GL���;��#]L�V�hZ��r%��q�<~Y���`�-�fN�͵z�~���|J����XjKCF�9�
6�U����������_��/׶���B����3�k��F��{g<�]��8`�dW�b�b�i?P!�~v
C��
,�b�̼���-��u�囃�d|N8m�\�ƕ��ƌ��3�%
n}],[�����6���9:��s�9<�����M�#uU�_Yp[�]��&H����K�wdp��$�7^�ۄjR]BSZ
�<N������W�=L+��g�%n'�}$jQ.A�)��S�v�o��{��Z,����!� �*�\�e����	��}Mu�zgTӴ��"��(�l�*)�����&+�ѳ��,��Q��Z�G�a\�p�
��j��d��O�Q��/�o�_�+���n���37ɨ����e=��
W㘪�TTȬ����.Lr�Yn��`L���B7�jU���t�BN^N�a):�h�']<���}N���Юƽ���k%�xp�
c�Wܟ"�	c�8W�)����xY��$��2�T0�?������@Z�X�{+�vO��Mq��pɈ���P̬�����p�b�Ȍ.����(��*~�uƥxƢ}���j��+���\ߐ/�����V�3�X;�Ŵ*��(<U[�ۚ�8n�I����Df#	6.�D�4���=v���8C�ۮvS��|e��˅+~�R��7��5�Ƹ)]^.q�b�=.��4*r<p�f�4���Rr7��q��N^�]#7�z-_��:������>���%�lzU;�-�-����I1&e�!|$>�X�je�=�lrb҄K�Q�4�8EX����& �d9
<僫�z��r��h�A^NX��?�m��k��ڻ����a�T��`��x���;����30��4�
J��f������O׭��W]�:^߃1�8��k`��Ow���a��e��qد��xʩ���4#�Q�I�u����ۘ���We�8��E/�����ı�^���<Sx���0�7�8�2*3g�?F�����v�+Y׫J�R�sݧ��V��<=�]
xN7�q{�|�(�g=��$���ۛw0���0Uƽ^��]���~��}�w�KzI��`i�~���e����i�|zv����S�F�H4e0���,T��	�Q�Ykt��g�:�:+�`�������|x>�6��b���CzBl�~�W~�9����b���k"M�J�<|H���I%
%B-�����%�V����-I��1�ݙiH�氦�T��M
��Q��L�c�e6�
�N��a�����n����ɲ�"���~u��n�p����ߓ

The message next to logs give a Failed status. the message reads: Add or update Azure app service build and deployment workflow config.

how should i proceed? I've already tried multiple ways to deploy this app but ended up deleting them all cos they didn't work. I created a fresh repo for this and tried again this time.

This is the app details in JSON format:

{
    "id": "/subscriptions/bxxxxxx-xxxxx-xx-xxxx-xxxxc/resourceGroups/rg-predictive-maintenance/providers/Microsoft.Web/sites/predictivemaintenance30daysml",
    "name": "predictivemaintenance30daysml",
    "type": "Microsoft.Web/sites",
    "kind": "app,linux",
    "location": "East US",
    "tags": {},
    "properties": {
        "name": "predictivemaintenance30daysml",
        "state": "Running",
        "hostNames": [
            "predictivemaintenance30daysml.azurewebsites.net"
        ],
        "webSpace": "rg-predictive-maintenance-EastUSwebspace-Linux",
        "selfLink": "https://waws-prod-blu-317.api.azurewebsites.windows.net:454/subscriptions/bxxxxxx-xxxxx-xx-xxxx-xxxxc/webspaces/rg-predictive-maintenance-EastUSwebspace-Linux/sites/predictivemaintenance30daysml",
        "repositorySiteName": "predictivemaintenance30daysml",
        "owner": null,
        "usageState": 0,
        "enabled": true,
        "adminEnabled": true,
        "afdEnabled": false,
        "enabledHostNames": [
            "predictivemaintenance30daysml.azurewebsites.net",
            "predictivemaintenance30daysml.scm.azurewebsites.net"
        ],
        "siteProperties": {
            "metadata": null,
            "properties": [
                {
                    "name": "LinuxFxVersion",
                    "value": "PYTHON|3.11"
                },
                {
                    "name": "WindowsFxVersion",
                    "value": null
                }
            ],
            "appSettings": null
        },
        "availabilityState": 0,
        "sslCertificates": null,
        "csrs": [],
        "cers": null,
        "siteMode": null,
        "hostNameSslStates": [
            {
                "name": "predictivemaintenance30daysml.azurewebsites.net",
                "sslState": 0,
                "ipBasedSslResult": null,
                "virtualIP": null,
                "virtualIPv6": null,
                "thumbprint": null,
                "certificateResourceId": null,
                "toUpdate": null,
                "toUpdateIpBasedSsl": null,
                "ipBasedSslState": 0,
                "hostType": 0
            },
            {
                "name": "predictivemaintenance30daysml.scm.azurewebsites.net",
                "sslState": 0,
                "ipBasedSslResult": null,
                "virtualIP": null,
                "virtualIPv6": null,
                "thumbprint": null,
                "certificateResourceId": null,
                "toUpdate": null,
                "toUpdateIpBasedSsl": null,
                "ipBasedSslState": 0,
                "hostType": 1
            }
        ],
        "computeMode": null,
        "serverFarm": null,
        "serverFarmId": "/subscriptions/bxxxxxx-xxxxx-xx-xxxx-xxxxc/resourceGroups/rg-predictive-maintenance/providers/Microsoft.Web/serverfarms/ASP-rgpredictivemaintenance-8669",
        "reserved": true,
        "isXenon": false,
        "hyperV": false,
        "lastModifiedTimeUtc": "2024-06-14T07:23:55.4533333",
        "storageRecoveryDefaultState": "Running",
        "contentAvailabilityState": 0,
        "runtimeAvailabilityState": 0,
        "dnsConfiguration": {},
        "vnetRouteAllEnabled": false,
        "containerAllocationSubnet": null,
        "useContainerLocalhostBindings": null,
        "vnetImagePullEnabled": false,
        "vnetContentShareEnabled": false,
        "siteConfig": {
            "numberOfWorkers": 1,
            "defaultDocuments": null,
            "netFrameworkVersion": null,
            "phpVersion": null,
            "pythonVersion": null,
            "nodeVersion": null,
            "powerShellVersion": null,
            "linuxFxVersion": "PYTHON|3.11",
            "windowsFxVersion": null,
            "windowsConfiguredStacks": null,
            "requestTracingEnabled": null,
            "remoteDebuggingEnabled": null,
            "remoteDebuggingVersion": null,
            "httpLoggingEnabled": null,
            "azureMonitorLogCategories": null,
            "acrUseManagedIdentityCreds": false,
            "acrUserManagedIdentityID": null,
            "logsDirectorySizeLimit": null,
            "detailedErrorLoggingEnabled": null,
            "publishingUsername": null,
            "publishingPassword": null,
            "appSettings": null,
            "metadata": null,
            "connectionStrings": null,
            "machineKey": null,
            "handlerMappings": null,
            "documentRoot": null,
            "scmType": null,
            "use32BitWorkerProcess": null,
            "webSocketsEnabled": null,
            "alwaysOn": false,
            "javaVersion": null,
            "javaContainer": null,
            "javaContainerVersion": null,
            "appCommandLine": null,
            "managedPipelineMode": null,
            "virtualApplications": null,
            "winAuthAdminState": null,
            "winAuthTenantState": null,
            "customAppPoolIdentityAdminState": null,
            "customAppPoolIdentityTenantState": null,
            "runtimeADUser": null,
            "runtimeADUserPassword": null,
            "loadBalancing": null,
            "routingRules": null,
            "experiments": null,
            "limits": null,
            "autoHealEnabled": null,
            "autoHealRules": null,
            "tracingOptions": null,
            "vnetName": null,
            "vnetRouteAllEnabled": null,
            "vnetPrivatePortsCount": null,
            "publicNetworkAccess": null,
            "cors": null,
            "push": null,
            "apiDefinition": null,
            "apiManagementConfig": null,
            "autoSwapSlotName": null,
            "localMySqlEnabled": null,
            "managedServiceIdentityId": null,
            "xManagedServiceIdentityId": null,
            "keyVaultReferenceIdentity": null,
            "ipSecurityRestrictions": null,
            "ipSecurityRestrictionsDefaultAction": null,
            "scmIpSecurityRestrictions": null,
            "scmIpSecurityRestrictionsDefaultAction": null,
            "scmIpSecurityRestrictionsUseMain": null,
            "http20Enabled": false,
            "minTlsVersion": null,
            "minTlsCipherSuite": null,
            "supportedTlsCipherSuites": null,
            "scmMinTlsVersion": null,
            "ftpsState": null,
            "preWarmedInstanceCount": null,
            "functionAppScaleLimit": 0,
            "elasticWebAppScaleLimit": null,
            "healthCheckPath": null,
            "fileChangeAuditEnabled": null,
            "functionsRuntimeScaleMonitoringEnabled": null,
            "websiteTimeZone": null,
            "minimumElasticInstanceCount": 0,
            "azureStorageAccounts": null,
            "http20ProxyFlag": null,
            "sitePort": null,
            "antivirusScanEnabled": null,
            "storageType": null,
            "sitePrivateLinkHostEnabled": null,
            "clusteringEnabled": false
        },
        "functionAppConfig": null,
        "daprConfig": null,
        "deploymentId": "predictivemaintenance30daysml",
        "slotName": null,
        "trafficManagerHostNames": null,
        "sku": "Free",
        "scmSiteAlsoStopped": false,
        "targetSwapSlot": null,
        "hostingEnvironment": null,
        "hostingEnvironmentProfile": null,
        "clientAffinityEnabled": false,
        "clientCertEnabled": false,
        "clientCertMode": 0,
        "clientCertExclusionPaths": null,
        "hostNamesDisabled": false,
        "ipMode": "IPv4",
        "vnetBackupRestoreEnabled": false,
        "domainVerificationIdentifiers": null,
        "customDomainVerificationId": "49F2B8FDD47621803DF0C687A577AADDAB7B5BD57D65610EEB5EB82D9E49E807",
        "kind": "app,linux",
        "managedEnvironmentId": null,
        "workloadProfileName": null,
        "resourceConfig": null,
        "inboundIpAddress": "20.119.16.1",
        "possibleInboundIpAddresses": "20.119.16.1",
        "ftpUsername": "predictivemaintenance30daysml\\$predictivemaintenance30daysml",
        "ftpsHostName": "ftps://waws-prod-blu-317.ftp.azurewebsites.windows.net/site/wwwroot",
        "outboundIpAddresses": "20.124.136.72,20.88.173.83,20.124.136.98,20.124.136.103,20.124.136.138,20.124.136.173,20.119.16.1",
        "possibleOutboundIpAddresses": "20.124.136.72,20.88.173.83,20.124.136.98,20.124.136.103,20.124.136.138,20.124.136.173,20.124.136.176,20.124.136.30,20.124.136.199,20.124.136.234,20.124.137.81,20.124.137.83,20.120.54.108,20.124.137.91,20.124.137.98,20.124.137.101,20.81.7.239,20.88.169.28,20.88.169.29,20.120.52.15,20.124.136.32,20.120.54.58,20.120.55.147,20.120.55.171,20.119.16.1",
        "containerSize": 0,
        "dailyMemoryTimeQuota": 0,
        "suspendedTill": null,
        "siteDisabledReason": 0,
        "functionExecutionUnitsCache": null,
        "maxNumberOfWorkers": null,
        "homeStamp": "waws-prod-blu-317",
        "cloningInfo": null,
        "hostingEnvironmentId": null,
        "tags": {},
        "resourceGroup": "rg-predictive-maintenance",
        "defaultHostName": "predictivemaintenance30daysml.azurewebsites.net",
        "slotSwapStatus": null,
        "httpsOnly": true,
        "endToEndEncryptionEnabled": false,
        "functionsRuntimeAdminIsolationEnabled": false,
        "redundancyMode": 0,
        "inProgressOperationId": null,
        "geoDistributions": null,
        "privateEndpointConnections": [],
        "publicNetworkAccess": "Enabled",
        "buildVersion": null,
        "targetBuildVersion": null,
        "migrationState": null,
        "eligibleLogCategories": "AppServiceAppLogs,AppServiceAuditLogs,AppServiceConsoleLogs,AppServiceHTTPLogs,AppServiceIPSecAuditLogs,AppServicePlatformLogs,ScanLogs,AppServiceAuthenticationLogs",
        "inFlightFeatures": [
            "SiteContainers"
        ],
        "storageAccountRequired": false,
        "virtualNetworkSubnetId": null,
        "keyVaultReferenceIdentity": "SystemAssigned",
        "autoGeneratedDomainNameLabelScope": null,
        "defaultHostNameScope": 0,
        "privateLinkIdentifiers": null,
        "sshEnabled": null
    }
}

This is the workflow file that was autocreated when I tried to deploy through the portal:

name: Build and deploy Python app to Azure Web App - predictivemaintenance30daysml
on:
  push:
    branches:
      - main
  workflow_dispatch:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python version
        uses: actions/setup-python@v1
        with:
          python-version: '3.11'
      - name: Create and start virtual environment
        run: |
          python -m venv venv
          source venv/bin/activate
      
      - name: Install dependencies
        run: pip install -r requirements.txt
        
      # Optional: Add step to run tests here (PyTest, Django test suites, etc.)
      - name: Zip artifact for deployment
        run: zip release.zip ./* -r
      - name: Upload artifact for deployment jobs
        uses: actions/upload-artifact@v3
        with:
          name: python-app
          path: |
			release.zip
            !venv/
  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
    
    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v3
        with:
          name: python-app
      - name: Unzip artifact for deployment
        run: unzip release.zip
      
      - name: 'Deploy to Azure Web App'
        uses: azure/webapps-deploy@v2
        id: deploy-to-webapp
        with:
          app-name: 'predictivemaintenance30daysml'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_915AB08AA4DA4A2F9C98B830007E8B9D }}

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,328 questions
{count} votes

Accepted answer
  1. ajkuma 24,566 Reputation points Microsoft Employee
    2024-06-20T13:59:33.2933333+00:00

    @Jyosna Philip , Scenario: Deploy Flask app the source code, failed to deploy Flask app to Azure Web App services using GitHub Actions.
    Error: Deployment Failed, Error: Failed to deploy web package to App Service. Conflict (CODE: 409)

    Resolution: Thanks for sharing the steps/solution that worked for you.

    Actions taken to narrow-down the issue to resolution:

    1. File System Storage Issue:
      • Student tier free service had a 1 GB quota.
      • TensorFlow library consumed about 500 MB, filling up the quota.
    2. Upgrade:
      • Upgraded to Basic B1 tier.
    3. Compute Power Issue:
      • App was consuming too much compute power.
    4. Optimization Steps:
      • Passed preprocessed data directly to the app, instead of raw data.
      • Removed unnecessary files (PCA.sav and Scaler.sav).
      • Improved app loading speed.
    5. Deployment Strategy:
      • Committed and pushed changes with at least a 2-hour gap.
      • Aimed to avoid issues with deployment triggers due to frequent pushes.

    Successful deployment of the webapp:
    User's image


    Please click Accept Answer - it will benefit the community/users to find the answer quickly.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful