Google 云 Api 网关 - {"message":"no healthy upstream","code":503}

Google Cloud Api Gateway - {"message":"no healthy upstream","code":503}

我正在构建一个托管在 App Engine Standard (Python) 上的 api。

我已经使用 curl 对其进行了测试,并且能够成功发出 post 请求:

curl --header "Content-Type: application/json" \
     --request POST \
     --data '{"amount":xxxx,"currency":"xxx","date":xxxx,"name":"xxxx","symbol":"xxx"}' \
     https://xxxxxxxxxx.appspot.com/api/add/ 

然后我部署了一个 Api 网关来访问我的 App Engine 标准后端。

Getting started with API Gateway and App Engine

我测试过它对 GET 请求工作正常。

现在我在执行 POST 请求时遇到问题。这是我来自 config.yaml 文件的代码:

/add:
    post:
      summary: Creates a new transaction.
      operationId: create-transaction
      consumes:
        - application/json
      parameters:
        - in: body
          name: transaction
          description: The transaction to create.
          schema:
            type: object
            required:
              - name
                symbol
                currency
                amount
                date
            properties:
              name:
                type: string
              symbol:
                type: string
              currency:
                type: string
              amount:
                type: number
              date:
                type: integer
          x-google-backend:
              address: https://xxxxxxx.appspot.com
              path_translation: [ APPEND_PATH_TO_ADDRESS ]
              jwt_audience: 272804158038-6kc250fms52o33b7dcfjrl1f9d8rripb.apps.googleusercontent.com          
      responses:
        '201':
          description: A successful transaction created
          schema:
            type: string      

当我尝试 运行 相同的 curl 命令时:

curl --header "Content-Type: application/json"      
     --request POST      
     --data '{"amount":xxxx,"currency":"xxx","date":xxxx,"name":"xxxx","symbol":"xxxx"}'     
      https://saxxx-xxxxxxx-gateway.dev/add/

我收到:

{"message":"no healthy upstream","code":503}

有人可以帮我解决此错误消息吗?同样,我能够 运行 在同一个网关上成功获取请求。

这是我在 Logging 上找到的日志:

{
 httpRequest: {
  latency: "0s"   
  protocol: "http"   
  remoteIp: ""   
  requestMethod: "POST"   
  requestSize: "936"   
  requestUrl: "/add"   
  responseSize: "158"   
  status: 503   
 }
 insertId: ""  
 jsonPayload: {
  api_key_state: "NOT CHECKED"   
  api_method: "1.xxxxxx_2ere0etrrw81sxxxxxxxxxxxxxx_cloud_goog.Createtransaction"   
  api_name: "1.xxxxxxxxxxx_api_2exxxxxx_cloud_goog"   
  api_version: "1.0.0"   
  location: ""   
  log_message: "1.sxxxxxxxxxxx.Createtransaction is called"   
  producer_project_id: "xxxxxx"   
  response_code_detail: "no_healthy_upstream"   
  service_agent: "ESPv2/2.21.0"   
  service_config_id: "sxxxxxxxx4jvuvmlcb"   
  timestamp: 1616270864.269634   
 }
 logName: "projects/sagexxxxxxxx.apigateway.xxxxxxxxx.cloud.goog%2Fendpoints_log"  
 receiveTimestamp: "2021-03-20T20:07:46.372838475Z"  
 resource: {
  labels: {
   location: ""    
   method: "1.xxxxxxxxxxxx_goog.Createtransaction"    
   project_id: ""    
   service: "xxxxxxxxxxxxx.cloud.goog"    
   version: "1.0.0"    
  }
  type: "api"   
 }
 severity: "ERROR"  
 timestamp: "2021-03-20T20:07:44.269633934Z"  
}
       

我的 config.yaml 文件代码有问题:

/add:
    post:
      summary: Creates a new transaction.
      operationId: create-transaction
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: body
          required: false
          schema:
            $ref: '#/definitions/Model0'
      x-google-backend:
              address: https://appspot.com
              path_translation: [ APPEND_PATH_TO_ADDRESS ]
              jwt_audience: .googleusercontent.com          
      responses:
        '201':
          description: A successful transaction created
          schema:
            type: string                               



definitions:
  Model0:
    properties:
      amount:
        type: number
        format: double
      currency:
        type: string
      date:
        type: integer
        format: int64
      name:
        type: string
      symbol:
        type: string