Deploying .jar to Azure Spring App hangs and fails

Gabriel Ruoff 0 Reputation points
2023-02-22T18:18:38.7433333+00:00

I am trying to deploy my spring app to an Azure Spring apps instance. I was able to deploy this app using the azure-spring-apps-maven-plugin in January, however I am now getting errors when attempting to deploy using the azure-spring-apps-maven-plugin, the az cli tool, and the AzureSpringCloud@0 task via Azure Pipelines. I would greatly appreciate if anyone can provide input on this issue.

Attempt #1 - Using azure-spring-apps-maven-plugin

  1. Ran mvn com.microsoft.azure:azure-spring-apps-maven-plugin:config
  2. Ran mvn clean package
  3. Ran mvn com.microsoft.azure:azure-spring-apps-maven-plugin:deploy

Result:

The app deployment starts updating then hangs for about 4 minutes and times out with error "Failed to execute goal com.microsoft.azure:azure-spring-apps-maven-plugin:1.14.0:deploy (default-cli) on project app: update Azure Spring App deployment (default): Long running operation is Failed or Cancelled."

Attempt #2 - Az cli tool

  1. Ran the following command
az spring app deploy \
--resource-group <name-of-resource-group> \
--service <service-instance-name> \
--name <app-name> \
--artifact-path target/<jar-name>

Result:

Error "App <app-name> not found". I have verified that the app name is correct and that the app exists.

Attempt #3 - Azure Pipelines

  1. Created a new pipeline that deploys using AzureSpringCloud@0
  2. Ran the pipeline
    - task: AzureSpringCloud@0
      inputs:
        azureSubscription: '<subscription-name>(<subscription-id>)'
        Action: 'Deploy'
        AzureSpringCloud: '/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.AppPlatform/Spring/<spring-apps-instance-name>'
        AppName: '<app-name>'
        UseStagingDeployment: false
        DeploymentName: 'default'
        Package: '$(System.DefaultWorkingDirectory)/target/*.jar'

Result:

Build succeeds, jar file is uploaded and app deployment begins. The task then hangs for 4 mins and exits with error:

##[error]Deployment Failed with Error: {}

##[error]Operation failed: 400 Bad Request

Logs show that the task is waiting for the deployment to finish

##[debug]App update initiated. ##[debug]Awaiting operation completion. ##[debug]App update initiated. ##[debug]Awaiting operation completion. ##[debug]Checking operation status at https://management.azure.com/subscriptions/56356497-c923-4ddf-b48e-0f443e320c21/resourceGroups/rg-hauberk-spring-apps/providers/Microsoft.AppPlatform/locations/eastus/operationResults/34a7de25-9e0b-4365-8224-11bf83fed2dc/Spring/default?api-version=2022-03-01-preview ##[debug]Sending GET request to https://management.azure.com/subscriptions/56356497-c923-4ddf-b48e-0f443e320c21/resourceGroups/rg-hauberk-spring-apps/providers/Microsoft.AppPlatform/locations/eastus/operationResults/34a7de25-9e0b-4365-8224-11bf83fed2dc/Spring/default?api-version=2022-03-01-preview ##[debug][GET]https://management.azure.com/subscriptions/56356497-c923-4ddf-b48e-0f443e320c21/resourceGroups/rg-hauberk-spring-apps/providers/Microsoft.AppPlatform/locations/eastus/operationResults/34a7de25-9e0b-4365-8224-11bf83fed2dc/Spring/default?api-version=2022-03-01-preview ##[debug]Correlation ID from ARM api call response : d2c51988-d91c-4365-99d6-aa468c568f3d ##[debug]https://management.azure.com/subscriptions/56356497-c923-4ddf-b48e-0f443e320c21/resourceGroups/rg-hauberk-spring-apps/providers/Microsoft.AppPlatform/locations/eastus/operationResults/34a7de25-9e0b-4365-8224-11bf83fed2dc/Spring/default?api-version=2022-03-01-preview ==> https://management.azure.com/subscriptions/56356497-c923-4ddf-b48e-0f443e320c21/resourceGroups/rg-hauberk-spring-apps/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/34a7de25-9e0b-4365-8224-11bf83fed2dc?api-version=2022-03-01-preview ##[debug]202: Accepted

The task continues to poll this endpoint until it receives a 400 response:

##[debug]400: Bad Request ##[debug]Error in awaiting operation completion ##[error]Deployment Failed with Error: {} ##[debug]Processed: ##vso[task.issue type=error;]Deployment Failed with Error: {} ##[debug]task result: Failed ##[error]Operation failed: 400 Bad Request ##[debug]Processed: ##vso[task.issue type=error;]Operation failed: 400 Bad Request ##[debug]Processed: ##vso[task.complete result=Failed;]Operation failed: 400 Bad Request

During attempts 1&3, it appears as it the .jar is uploaded and deployment begins. The process then hangs for 4 minutes until it times out because the deployment never completes.

Solutions I have tried:

  1. Creating a new spring project and trying to deploy it (same outcome)
  2. Re-creating the Azure Spring Apps instance (same outcome)
  3. Downgrading the app's java version (17->11) (same outcome)
Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
109 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hanli Ren 0 Reputation points Microsoft Employee
    2023-02-24T06:51:11.03+00:00

    For deployment failure issue, we usually can follow these steps to investigate it:

    1. Make sure the Azure Spring Apps service instance is in healthy status before you deploy new apps to it.
      We can go to Azure Spring Apps Portal -> Overview, check Status. Make sure it's "Succeeded (Running)"
    2. When we deploy jar file to an App Deployment, we can use log stream to check the application log, make sure whether it's successfully boot up.
      Here is the doc for your reference of how to use log stream:
      https://learn.microsoft.com/en-us/azure/spring-apps/how-to-log-streaming?tabs=azure-portal
    0 comments No comments