Google App Engine Flexible deploy throwing ERROR: (gcloud.app.deploy) HttpError accessing
Google App Engine Flexible deploy throwing ERROR: (gcloud.app.deploy) HttpError accessing
您好,我在将 nodejs 应用程序部署到灵活引擎时遇到此错误。我无法弄清楚问题出在哪里。
我收到的错误消息
ERROR: (gcloud.app.deploy) HttpError accessing <https://appengine.googleapis.com/v1/apps/project-id/services/testws/versions?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Fri, 26 Mar 2021 20:37:27 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': '500', 'content-length': '109', '-content-encoding': 'gzip'}>, content <{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
>
This may be due to network connectivity issues. Please check your network settings, and the status of the service you are trying to reach.
app.yaml
runtime: nodejs
env: flex
service: testws
manual_scaling:
instances: 1
network:
session_affinity: true
resources:
cpu: 1
memory_gb: 1
disk_size_gb: 2
env_variables:
KEY: "dev"
PRIVATE_KEY_URL: "key"
skip_files:
- ^node_modules/.*$
Gcloud SDK版本
Google Cloud SDK 333.0.0
bq 2.0.65
core 2021.03.19
gsutil 4.60
kubectl 1.17.17
我已经通过 运行 gcloud app deploy --verbosity="debug"
添加了调试日志
调试日志
>
This may be due to network connectivity issues. Please check your network settings, and the status of the service you are trying to reach.
Traceback (most recent call last):
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 982, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 809, in Run
resources = command_instance.Run(args)
File "/Users/shashi/google-cloud-sdk/lib/surface/app/deploy.py", line 130, in Run
use_legacy_apis=args.use_legacy_apis)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 678, in RunDeploy
ignore_file=args.ignore_file)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 455, in Deploy
extra_config_settings)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 172, in DeployService
extra_config_settings)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 249, in _CreateVersion
return self.client.apps_services_versions.Create(create_request)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/appengine/v1/appengine_v1_client.py", line 830, in Create
config, request, global_params=global_params)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 729, in _RunMethod
http, http_request, **opts)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 350, in MakeRequest
check_response_func=check_response_func)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 406, in _MakeRequestNoRetry
check_response_func(response)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/apis.py", line 267, in _CheckResponseForApiEnablement
http_wrapper.CheckResponse(response)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 223, in CheckResponse
raise exceptions.BadStatusCodeError.FromResponse(response)
apitools.base.py.exceptions.BadStatusCodeError: HttpError accessing <https://appengine.googleapis.com/v1/apps/project-id/services/awsockets/versions?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Sun, 28 Mar 2021 22:29:25 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': '500', 'content-length': '109', '-content-encoding': 'gzip'}>, content <{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
>
如果有人遇到这个问题,我找到了错误的原因和解决方法。
原因 - App 引擎灵活服务帐户被意外从 google 云项目中删除。如本文所述 link - service-account
The App Engine flexible environment service agent has the App Engine Flexible Environment Service Agent role. The role includes a set of permissions needed by Node.js flexible environment to manage your flexible environment apps. For example, this role includes permissions to perform the following tasks:
1. Deploying a new version.
2. Stopping or deleting existing versions.
3. Automatic weekly restarts and system updates.
解决方案 - 添加一个服务帐户,方法是转到 IAM 并添加一个具有角色 App Engine Flexible Environment Service Agent[=32= 名称的帐户].如本文所述 link - restore-service-account
service-[YOUR_PROJECT_NUMBER]@gae-api-prod.google.com.iam.gserviceaccount.com
我已提出 google 跟踪器的问题以更改错误消息。您可以在此处跟踪问题 - issue-tracker
更新 - 添加下图以进一步说明。如果您尝试添加已删除的帐号,系统会提示。
我在部署到标准环境时遇到了类似的错误信息。
为了解决它,我按照建议在 gcloud app deploy --verbosity="debug"
中添加了 verbosity=debug 标志。
然后我可以看到我之前的令牌替换步骤不起作用,导致无效 app.yaml
详细输出显示 app.yaml 像这样。
2022-05-25T23:39:43.8269116Z DEBUG: Converted YAML to JSON: "{
2022-05-25T23:39:43.8269423Z "basicScaling": {
2022-05-25T23:39:43.8269664Z "idleTimeout": "900s",
2022-05-25T23:39:43.8269912Z "maxInstances": 4
2022-05-25T23:39:43.8270102Z },
2022-05-25T23:39:43.8270288Z "entrypoint": {
2022-05-25T23:39:43.8270550Z "shell": "npm run start:prod"
2022-05-25T23:39:43.8270764Z },
2022-05-25T23:39:43.8271862Z "instanceClass": "B4",
2022-05-25T23:39:43.8272089Z "runtime": "nodejs16",
2022-05-25T23:39:43.8272316Z "vpcAccessConnector": {
2022-05-25T23:39:43.8272882Z "name": "projects/#{project_id}#/locations/#{region}#/connectors/sql-access-conn-#{environment}#"
2022-05-25T23:39:43.8273192Z }
2022-05-25T23:39:43.8273380Z }"
为 vpcAccessConnector 输入有效的 project_id 修复了错误。
您好,我在将 nodejs 应用程序部署到灵活引擎时遇到此错误。我无法弄清楚问题出在哪里。
我收到的错误消息
ERROR: (gcloud.app.deploy) HttpError accessing <https://appengine.googleapis.com/v1/apps/project-id/services/testws/versions?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Fri, 26 Mar 2021 20:37:27 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': '500', 'content-length': '109', '-content-encoding': 'gzip'}>, content <{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
>
This may be due to network connectivity issues. Please check your network settings, and the status of the service you are trying to reach.
app.yaml
runtime: nodejs
env: flex
service: testws
manual_scaling:
instances: 1
network:
session_affinity: true
resources:
cpu: 1
memory_gb: 1
disk_size_gb: 2
env_variables:
KEY: "dev"
PRIVATE_KEY_URL: "key"
skip_files:
- ^node_modules/.*$
Gcloud SDK版本
Google Cloud SDK 333.0.0
bq 2.0.65
core 2021.03.19
gsutil 4.60
kubectl 1.17.17
我已经通过 运行 gcloud app deploy --verbosity="debug"
添加了调试日志调试日志
>
This may be due to network connectivity issues. Please check your network settings, and the status of the service you are trying to reach.
Traceback (most recent call last):
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 982, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 809, in Run
resources = command_instance.Run(args)
File "/Users/shashi/google-cloud-sdk/lib/surface/app/deploy.py", line 130, in Run
use_legacy_apis=args.use_legacy_apis)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 678, in RunDeploy
ignore_file=args.ignore_file)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 455, in Deploy
extra_config_settings)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 172, in DeployService
extra_config_settings)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 249, in _CreateVersion
return self.client.apps_services_versions.Create(create_request)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/appengine/v1/appengine_v1_client.py", line 830, in Create
config, request, global_params=global_params)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 729, in _RunMethod
http, http_request, **opts)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 350, in MakeRequest
check_response_func=check_response_func)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 406, in _MakeRequestNoRetry
check_response_func(response)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/apis.py", line 267, in _CheckResponseForApiEnablement
http_wrapper.CheckResponse(response)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 223, in CheckResponse
raise exceptions.BadStatusCodeError.FromResponse(response)
apitools.base.py.exceptions.BadStatusCodeError: HttpError accessing <https://appengine.googleapis.com/v1/apps/project-id/services/awsockets/versions?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Sun, 28 Mar 2021 22:29:25 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': '500', 'content-length': '109', '-content-encoding': 'gzip'}>, content <{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
>
如果有人遇到这个问题,我找到了错误的原因和解决方法。
原因 - App 引擎灵活服务帐户被意外从 google 云项目中删除。如本文所述 link - service-account
The App Engine flexible environment service agent has the App Engine Flexible Environment Service Agent role. The role includes a set of permissions needed by Node.js flexible environment to manage your flexible environment apps. For example, this role includes permissions to perform the following tasks:
1. Deploying a new version.
2. Stopping or deleting existing versions.
3. Automatic weekly restarts and system updates.
解决方案 - 添加一个服务帐户,方法是转到 IAM 并添加一个具有角色 App Engine Flexible Environment Service Agent[=32= 名称的帐户].如本文所述 link - restore-service-account
service-[YOUR_PROJECT_NUMBER]@gae-api-prod.google.com.iam.gserviceaccount.com
我已提出 google 跟踪器的问题以更改错误消息。您可以在此处跟踪问题 - issue-tracker
更新 - 添加下图以进一步说明。如果您尝试添加已删除的帐号,系统会提示。
我在部署到标准环境时遇到了类似的错误信息。
为了解决它,我按照建议在 gcloud app deploy --verbosity="debug"
中添加了 verbosity=debug 标志。
然后我可以看到我之前的令牌替换步骤不起作用,导致无效 app.yaml
详细输出显示 app.yaml 像这样。
2022-05-25T23:39:43.8269116Z DEBUG: Converted YAML to JSON: "{
2022-05-25T23:39:43.8269423Z "basicScaling": {
2022-05-25T23:39:43.8269664Z "idleTimeout": "900s",
2022-05-25T23:39:43.8269912Z "maxInstances": 4
2022-05-25T23:39:43.8270102Z },
2022-05-25T23:39:43.8270288Z "entrypoint": {
2022-05-25T23:39:43.8270550Z "shell": "npm run start:prod"
2022-05-25T23:39:43.8270764Z },
2022-05-25T23:39:43.8271862Z "instanceClass": "B4",
2022-05-25T23:39:43.8272089Z "runtime": "nodejs16",
2022-05-25T23:39:43.8272316Z "vpcAccessConnector": {
2022-05-25T23:39:43.8272882Z "name": "projects/#{project_id}#/locations/#{region}#/connectors/sql-access-conn-#{environment}#"
2022-05-25T23:39:43.8273192Z }
2022-05-25T23:39:43.8273380Z }"
为 vpcAccessConnector 输入有效的 project_id 修复了错误。