Google appengine / ah / health"方法不存在。"

时间:2017-12-10 11:12:49

标签: google-app-engine go

对projectname.appspot.com/_ah/health的请求会返回以下错误

{
 "code": 5,
 "message": "Method does not exist.",
 "details": [
  {
   "@type": "type.googleapis.com/google.rpc.DebugInfo",
   "stackEntries": [],
   "detail": "service_control"
  }
 ]
}

在本地测试,它工作正常。

缩写为app.yaml:

runtime: go
env: flex
api_version: go1

app.go主要功能:

func main() {

    r := mux.NewRouter()

    r.HandleFunc("/", handler)

    r.HandleFunc("/_ah/health", healthCheckHandler)

    http.Handle("/", r)

    port := 8080
    if portStr := os.Getenv("PORT"); portStr != "" {
        port, _ = strconv.Atoi(portStr)
    }
    log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
}

任何想法出了什么问题?

1 个答案:

答案 0 :(得分:1)

将其添加到开放API

paths:
  "/_ah/health":
    get:
      operationId: "OkStatus"
      security: []
      responses:
        200:
          description: "Ok message"

不能通过ESP代理