Azure YAML部署失败,并显示“错误:无法将Web包部署到App Service。冲突(CODE:409)”

时间:2020-01-14 20:35:41

标签: node.js azure azure-web-app-service kudu

希望有人也看到了这一点。 我们上一次成功的构建是在2019年12月6日。 新的部署尝试在部署步骤失败(在Build和Release管道中出现相同的问题)。

错误报告如下:

Got service connection details for Azure App Service:'OUR SITE'
Package deployment using ZIP Deploy initiated.
##[error]Failed to deploy web package to App Service.
##[error]Error: Error: Failed to deploy web package to App Service. Conflict (CODE: 409)
##[warning]Error: Failed to update deployment history. Error: Bad Request (CODE: 400)
App Service Application URL: OUR SITE

这是我们的部署YAML,很抱歉,已经有好几天了:(

# Node.js Express Web App to Linux on Azure
# Build a Node.js Express app and deploy it to Azure as a Linux web app.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

variables:

  # Azure Resource Manager connection created during pipeline creation
  azureSubscription: '[OUR SUB ID]'

  # Web app name
  webAppName: 'website-to-deploy'

  # Environment name
  environmentName: 'web-to-deploy'

  # Agent VM image name
  vmImageName: 'ubuntu-latest'

stages:
- stage: Build
  displayName: Build stage
  jobs:  
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)

    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '10.x'
      displayName: 'Install Node.js'

    - script: |
        npm install
        npm run build --if-present
        npm run test --if-present
      displayName: 'npm install, build and test'

    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
        includeRootFolder: false
        archiveType: zip
        archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
        replaceExistingArchive: true

    - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
      artifact: drop
    - task: AzureRmWebAppDeployment@4
      inputs:
        ConnectionType: 'AzureRM'
        azureSubscription: 'OUR SUBSCRIPTION'
        appType: 'webAppLinux'
        WebAppName: 'site-to-deploy'
        packageForLinux: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
        RuntimeStack: 'NODE|12-lts'
        StartupCommand: 'npm start'
        AppSettings: 'WE DO HAVE SOME SETTINGS'     

请注意: 我尝试将WEBSITE_WEBDEPLOY_USE_SCM = true添加到配置中,但这没有帮助。
对上述版本YAML的更改没有任何变化,该更改已成功运行并馈入发布管道

感谢您的帮助。

更新:MS Dev-Ops提出的故障单 您可以在变量部分添加system.debug: true,以获得更详细的日志记录。
这使我看到AppService返回了409代码,因为它认为已经在进行部署。 如果有解决办法,我将在本文中进行编辑。

这是调试信息:

##[debug]Encountered a retriable status code: 409. Message: 'Conflict'.
##[debug][POST]https://$web040-glndev-com:***@web040-glndev-com.scm.azurewebsites.net/api/zipdeploy?isAsync=true&deployer=VSTS_ZIP_DEPLOY
##[debug]Could not parse response: {}
##[debug]Response: undefined
##[debug]Encountered a retriable status code: 409. Message: 'Conflict'.
##[debug][POST]https://$web040-glndev-com:***@web040-glndev-com.scm.azurewebsites.net/api/zipdeploy?isAsync=true&deployer=VSTS_ZIP_DEPLOY
##[debug]Could not parse response: {}
##[debug]Response: undefined
##[debug]ZIP Deploy response: {"statusCode":409,"statusMessage":"Conflict","headers":{"transfer-encoding":"chunked","content-type":"text/plain; charset=utf-8","server":"Kestrel","date":"Wed, 15 Jan 2020 17:40:47 GMT","connection":"close"},"body":"There is a deployment currently in progress. Please try again when it completes."}
##[error]Failed to deploy web package to App Service.
##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to App Service.
##[debug]task result: Failed
##[error]Error: Error: Failed to deploy web package to App Service. Conflict (CODE: 409)
##[debug]Processed: ##vso[task.issue type=error;]Error: Error: Failed to deploy web package to App Service. Conflict (CODE: 409)
##[debug]Processed: ##vso[task.complete result=Failed;]Error: Error: Failed to deploy web package to App Service. Conflict (CODE: 409)
##[debug][POST]https://management.azure.com/subscriptions/7a7aad03-79b0-4118-8dd1-8ebd63716c6a/resourceGroups/appsvc_linux_centralus/providers/Microsoft.Web/sites/web040-glndev-com/config/appsettings/list?api-version=2016-08-01
##[debug]Correlation ID from ARM api call response : e4ebaf0f-7ccf-4b7b-ba4d-b70b8fd13bea
##[debug]Application Insights is not configured for the App Service. Skipping adding release annotation.

门票在这里:409 Unable to deploy web package

6 个答案:

答案 0 :(得分:3)

重新启动App Service解决了我的问题。

我的App服务计划已经是付费订阅,容量没有问题。我刚刚重新启动了App Service,一切正常。

答案 1 :(得分:2)

因此,在与MS支持进行了大量讨论之后,Here is the ticket

可以看出,真正的问题是我的应用服务计划已达到极限。在开发过程中,我们使用了免费服务,并且存在限制。我们已经达到了这个极限,这条信息确实是一条红色的鲱鱼,根本不是真正的问题。

无论如何,我已升级到付费订阅的第一层,现在一切正常。

答案 2 :(得分:0)

目前(2020年7月/八月),问题实际上是Microsoft对支持某些区域中的应用程序服务的VM的更新,如以下github问题中所述:https://github.com/projectkudu/kudu/issues/3042

解决方法(在此回复中列出:https://github.com/projectkudu/kudu/issues/3042#issuecomment-665997217)似乎有帮助。要么

  1. 通过SCM门户重新启动Kudu(通过“进程浏览器”选项卡杀死w3wp进程)
  2. 重新启动应用程序服务(导致停机)
  3. 上下扩展您的服务(尽管有些人报告说他们必须在两者之间进行部署)

答案 3 :(得分:0)

我遇到了同样的错误,问题出在webapp的大小上。我尝试将具有1 GB以上的Webapp部署到具有1GB应用程序服务层级的Azure Webapp。

答案 4 :(得分:0)

我犯的一个错误是从另一个函数应用中复制了所有配置,包括 WEBSITE_ENABLE_SYNC_UPDATE_SITE 和 WEBSITE_RUN_FROM_PACKAGE。删除它们并重新部署。

答案 5 :(得分:0)

我也遇到了这个问题,因为日志文件损坏了(在 kudu/部署过程崩溃之后)。如果您有一个 linux 实例,您可以将选项 AppService log 关闭(重新启动),然后再将其打开