4

When I deploy my Go application to GAE, the /_ah/start endpoint is never invoked. When I run the following code, the log does not contain the "STARTING" entry and / does not have the X set.

What am I missing?

server.go:

package main

import (
    "net/http"

    "google.golang.org/appengine"
    "google.golang.org/appengine/log"
)

var X string

func init() {
    http.HandleFunc("/_ah/start", start)
    http.HandleFunc("/", meh)
}

func start(w http.ResponseWriter, r *http.Request) {
    X = "!!!!!"
    c := appengine.NewContext(r)
    log.Infof(c, "STARTING")
}

func meh(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("The value is: " + X))
}

app.yaml:

application: my-app
version: 1
runtime: go
api_version: go1

handlers:
- url: /.*
  secure: always
  script: _go_app
Adya
  • 5
  • 7
Konrad Garus
  • 50,165
  • 42
  • 145
  • 220

1 Answers1

2

app.yml with manual scaling.

application: my-app
version: 1
runtime: go
api_version: go1

handlers:
- url: /.*
  secure: always
  script: _go_app

instance_class: B8
manual_scaling:
  instances: 5

https://cloud.google.com/appengine/docs/go/an-overview-of-app-engine#scaling_types_and_instance_classes

mattes
  • 7,580
  • 1
  • 38
  • 64