1
votes

I am in the process of migrating a simple app using the Go 1.11 runtime from the AppEngine flex environment to the standard environment because flex got shockingly expensive for my low-traffic site (and standard wasn't available for this runtime until recently). Every time GAE hits the /_ah/start endpoint for my app it logs a 301 and the following error: Process terminated because it failed to respond to the start request with an HTTP status code of 200-299 or 404.

My server does have a handler for /_ah/start that simply writes a 200 and works fine locally. I also tried adding a handler for all routes in app.yaml just to make sure requests to the AppEngine load balancer are actually being routed to my server, but it still isn't working. I know from the service logs that my server is starting and listening on the correct port but it gets restarted over and over and can't actually handle any requests because of this issue with the GAE start request.

Here's my app.yaml:

runtime: go111
instance_class: B1
basic_scaling:
  max_instances: 1
handlers:
- url: /.*
  script: auto

Edit: Here's a screenshot of the logs

1
Show messages logged for the application and the code that runs the net/http server.Cerise Limón
Edited my original post to include a screenshot of the logs!Kayla Fuchs
The application responds to /_ah/start with a redirect (status 301). How did you determine that the application responds with a 200 running locally? Does the application redirect any requests?Cerise Limón
When I run my server locally I am able to hit /_ah/start and it returns a 200. I am not sure how to mimic the setup of the actual AppEngine environment locally so that basically just validates that my server works as expected in a more general sense, not that it works in the context of AppEngine. I have no idea where the redirect is coming from when I deploy to GAE, but it's interesting that that first error log happens before my server logs anything, meaning it's trying to hit that endpoint before running main.go.Kayla Fuchs
My server only redirects http traffic to https, which I added when I was using the flex environment. I wonder if that's the culprit? I'll try removing that middleware and see what happens.Kayla Fuchs

1 Answers

1
votes

The application redirects http to https per discussion in the comments.

An application running in the standard environment must serve http. The App Engine infrastructure handles https.

Fix by removing the redirect from http to https.