创建了一个新项目,在第一次部署时我得到这个:
Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [13] Flex operation projects/primalexchange/regions/us-east1/operations/b5a5813a-14bf-43b6-af7f-e17b15866c4f error [INTERNAL]: An internal error occurred while processing task /appengine-flex-v1/insert_flex_deployment/flex_create_resources>2020-05-16T23:23:08.373Z4721.jc.14: Deployment Manager operation primalexchange/operation-1589671388926-5a5cc367252d6-eae4c5cb-bc5f1a6e errors: [code: "RESOURCE_ERROR"
location: "/deployments/aef-default-20200516t192110/resources/aef-default-20200516t192110"
message: "{\"ResourceType\":\"compute.beta.regionAutoscaler\",\"ResourceErrorCode\":\"403\",\"ResourceErrorMessage\":{\"code\":403,\"errors\":[{\"domain\":\"usageLimits\",\"message\":\"Exceeded limit \'QUOTA_FOR_INSTANCES\' on resource \'aef-default-20200516t192110\'. Limit: 8.0\",\"reason\":\"limitExceeded\"}],\"message\":\"Exceeded limit \'QUOTA_FOR_INSTANCES\' on resource \'aef-default-20200516t192110\'. Limit: 8.0\",\"statusMessage\":\"Forbidden\",\"requestPath\":\"https://compute.googleapis.com/compute/beta/projects/primalexchange/regions/us-east1/autoscalers\",\"httpMethod\":\"POST\"}}"
构建器中的构建显示为已成功完成。
它在版本下显示我有一个版本,有 0 个实例,100% 流量分配,当您单击该版本时,它会将您带到我的网站,显示 404 错误。
可能是因为它说服务已停止,这可能是因为它没有“更新”。
我不认为这是“我的代码”的事情,因为我对曾经成功部署在不同项目下的版本进行了 git checkout,这基本上相当于一个 hello world 应用程序,虽然它曾经成功,但现在是失败。此外,几天前我在同一项目下进行了另一个工作部署,但是当我使用更新的代码进行部署时,部署失败,并出现这个错误,导致我删除整个项目并重新开始,并且现在我在这个新项目上遇到了同样的错误。我如何知道问题不是由我的代码引起的?我的构建由于我的代码而失败,并且构建的日志泄露了这一点。到这里就构建成功了。构建中没有失败。
所以我去了这个网址https://compute.googleapis.com/compute/beta/projects/primalexchange/regions/us-east1/autoscalers https://compute.googleapis.com/compute/beta/projects/primalexchange/regions/us-east1/autoscalers其中指出:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"errors": [
{
"message": "Login Required.",
"domain": "global",
"reason": "required",
"location": "Authorization",
"locationType": "header"
}
],
"status": "UNAUTHENTICATED"
}
}
我不知道这是我的问题还是其他问题。我什至不知道这到底意味着什么。所以我确保我在“projectid.json”上有信用
并做了
导出 GOOGLE_APPLICATION_CREDENTIALS='projectid-2c8anumber842b4.json'
我断开了与我的 firebase 登录内容相关的代码。
我执行了这些命令
gcloud services enable servicemanagement.googleapis.com
gcloud services enable servicecontrol.googleapis.com
gcloud services enable endpoints.googleapis.com
我不知道如何解决这个问题。我整个周末都在努力修复它。
I when to Quota's under IAM, and looked at the quota for autoscalers in us-east1 and I found this which is not over anything:
唯一限制为 8 的是 cpu,它说我的限制是 2。
我不知道我搞砸了什么。。
是的,计费已启用。
I just ran across this, which maybe this will get me some place...
什么是授权标头?为什么我第一次不需要这个……或者这次我搞砸了什么。
我更改了代码,这样您得到的只是 hello world 的拼写错误,并且部署仍然失败:
import logging
from flask import Flask, jsonify, redirect, url_for
from flask import request, make_response
from flask import render_template
from image_upload import upload_blob
from google.cloud import storage
from google.cloud import datastore
from datetime import datetime
from cryptography.fernet import Fernet
from models.media import Media
from models.user import User
from google.cloud import ndb
import json
import random
from uuid import uuid4
from flask import Flask, make_response, request
from google.auth.transport import requests
import google.oauth2.id_token
# from google.cloud import firestore
from flask_wtf.csrf import CSRFProtect, generate_csrf
from werkzeug.utils import secure_filename
from werkzeug.exceptions import RequestEntityTooLarge
@app.route('/', methods=['GET'])
def hi():
return "hellow world"
@app.errorhandler(500)
def server_error(e):
logging.exception('An error occurred during a request.')
return """
An internal error occurred: <pre>{}</pre>
See logs for full stacktrace.
""".format(e), 500
if __name__ == '__main__':
# This is used when running locally. Gunicorn is used to run the
# application on Google App Engine. See entrypoint in app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
现在,我更仔细地观察这一点,当我显然有双重导入 Flask 时,这甚至是如何在本地运行的?
我将在删除它后尝试进行部署,但我怀疑这就是问题所在,我很快就会回来发表另一篇关于此问题的文章。
是的,那没关系。还是失败了。
这张图片来自我开始的第三个项目。到目前为止我已经部署了它......它失败并出现相同的错误:
这是App.yaml
runtime: python
api_version: '1'
env: flexible
threadsafe: true
handlers:
- url: /static/(.*)
application_readable: true
static_files: __static__/static/\1
require_matching_file: false
upload: __static__/static/.*
- url: /.*
script: main.app
secure: never
env_variables:
SECRET_KEY: ____________
automatic_scaling:
cool_down_period: 120s
min_num_instances: 2
max_num_instances: 20
cpu_utilization:
target_utilization: 0.5
network: {}
liveness_check:
initial_delay_sec: 300
check_interval_sec: 30
timeout_sec: 4
failure_threshold: 4
success_threshold: 2
readiness_check:
check_interval_sec: 5
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
app_start_timeout_sec: 300
看起来,当我部署时,当我检查配额时,我的 IP 地址使用限制为 4,然后当我没有使用限制时,它会回落到 2。那么也许有人可以建议我如何设置我的 app.yaml 来避免这种情况?我对缩放一无所知,所以我想进行自动缩放,而这个 app.yaml 基本上是默认设置。
没关系。我将配额增加到 6,但仍然出错。