gcloud应用程序部署触发奇怪的错误:文件的SHA1和冲突

时间:2019-01-05 04:51:39

标签: google-app-engine google-cloud-platform gcloud

我正在尝试获取一个简单的HelloWorld!将部署设置部署到AppEngine。我正在与另一个朋友/开发人员一起工作,他/她的计算机上的开发人员能够使这个简单的gcloud app deploy成功运行,但是在我的计算机上却无法正常工作(经典的在我的计算机上工作 )。我想知道这是否是我们存储桶的权限问题,但是我和我朋友的AppEngine帐户之间的所有内容均已镜像。我乐于助人,因此可以提供任何帮助。

我将描述要遵循的内容似乎在互联网上很少见,因此我希望有知识的人可以提供帮助。

  • 我已安装并验证了GoogleCloudSDK。
  • 我有一个名为“ default”的简单目录,其中包含一个app.yaml和一个index.html

运行gcloud app deploy default命令时,出现以下错误:

Beginning deployment of service [default]...
╔═════════════════════════════════════════════╗
╠═ Uploading 2 files to Google Cloud Storage ═╣
╚═════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [3] The following errors occurred while copying files to App Engine:
File https://storage.googleapis.com/staging.xxxxxxx.appspot.com/59add2715212c2a5fa68f05ead6ea6a307d279b5 failed with: Conflicting SHA1 sum for file. Expected "90d147b8_dd2137ab_8ec7f19f_c0891006_6585d3de" but received "59add271_5212c2a5_fa68f05e_ad6ea6a3_07d279b5".

Details: [
  [
    {
      "@type": "type.googleapis.com/google.rpc.ResourceInfo",
      "description": "Conflicting SHA1 sum for file. Expected \"90d147b8_dd2137ab_8ec7f19f_c0891006_6585d3de\" but received \"59add271_5212c2a5_fa68f05e_ad6ea6a3_07d279b5\".",
      "resourceName": "https://storage.googleapis.com/staging.xxxxxxx.appspot.com/59add2715212c2a5fa68f05ead6ea6a307d279b5",
      "resourceType": "file"
    }
  ]
]

我尝试过的

  • 删除存储桶中的所有文件。
  • 在staging.xxxxxxx.appspot.com上删除整个存储桶。
  • Wrapper DLL卸载并重新安装SDK。我在Windows 10 64位上。
  • 重新运行gcloud init并按照这些说明进行操作。
  • 重新运行gcloud auth application-default login并使用我的Google帐户进行身份验证。

这是我的示例文件

app.yaml

runtime: nodejs10

handlers:
- url: /
  static_files: index.html
  upload: index.html

index.html

<html>
  <head>
    <title>Test Title</title>
  </head>
  <body>
    <p>
      Hello from the static index.html file.
    </p>
  </body>
</html>

2 个答案:

答案 0 :(得分:0)

问题摘要: Windows本地计算机文件系统上和Google Cloud Storage中的文本文件大小不同-SHA校验和比较失败。

可能的解决方案:

  
      
  1. 在使用Dos2Unix通过Cigwin部署应用之前,先在本地修复文件
  2.   

或从Linux部署:

  
      
  1. 将部署文件上传到Cloud Shell并从那里进行部署。
  2.   
  3. 将部署文件上传到Linux VM Instance
  4.   

有关Windows and Unix interoperability的摘要,请查看文档

答案 1 :(得分:0)

使用旧方法进行部署-appcfg.py: https://cloud.google.com/appengine/docs/standard/python/tools/appcfg-arguments

为我工作。

或者您可以看到以下答案: https://stackoverflow.com/a/52894113/8244338