我正在尝试获得一个简单的 HelloWorld! AppEngine 的部署设置。我正在与另一位 friend /开发人员合作,他在他的机器上能够让这个简单的 gcloud app deploy
成功运行,但在我的机器上它不起作用(经典 在我的机器上运行机)。我想知道这是否是我们的存储桶的权限问题,但我和我 friend 的 AppEngine 帐户之间的所有内容都是镜像的。我在我的智慧,所以任何帮助表示赞赏。
我将要描述的内容似乎在 Internet 上很少见,因此我希望有知识的人可以提供帮助。
- 我已经安装并验证了 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 上的整个存储桶。
- 从 https://cloud.google.com/sdk/ 卸载并重新安装 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>
最佳答案
问题总结: Windows 本地计算机文件系统和 Google 云存储中的文本文件大小不同 - SHA 校验和比较失败。
可能的解决方案:
- Fix files locally before deploying app using Dos2Unix using Cigwin,
或从 Linux 部署:
- Upload deployment files to Cloud Shell and deploy from there.
- Upload deployment files to Linux VM Instance.
关于 Windows and Unix interoperability 的摘要, 检查文档
关于google-app-engine - gcloud app deploy 触发奇怪的错误 : Conflicting SHA1 sum for file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54049081/