Home > Software design >  App engine 404 Error for readiness check even with increased app_start_timeout_sec
App engine 404 Error for readiness check even with increased app_start_timeout_sec

Time:08-24

First off, I would like to state that I have scoured SO for a solution, yet nothing worked for me...

I am trying to deploy a flask server on App engine, yet I always get a 404 Error with /readiness_check failReason:"null"

This is my app.yaml (yes, I did increase the app_start_timeout_sec)

    # yaml config for custom environment that uses docker
    runtime: custom
    env: flex
    service: test-appengine
    # change readiness check ; 
    # rediness failure leads to 502 Error
    readiness_check:
      path: "/readiness_check"
      check_interval_sec: 5
      timeout_sec: 4
      failure_threshold: 2
      success_threshold: 2
      app_start_timeout_sec: 1800

And this is my Dockerfile:

# Use the official Python image.
# https://hub.docker.com/_/python
FROM python:3.8-buster

# Install Python dependencies.
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . .

# expose port 8080 for app engine
EXPOSE 8080

# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.

# CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 main:app
CMD ["gunicorn", "main:app", "-b", ":8080", "--timeout", "300"]

Finally, my main.py contains a very basic route, for the sake of the argument :

from flask import Flask


app = Flask(__name__)


@app.route("/")
def return_hello():
    return "Hello!"

Could you please let me know what I'm doing wrong? Have been battling this issue for days now ... Thank you !

CodePudding user response:

I believe you still need to define the handler for your readiness_check (you're getting 404 which means route not found).

See this article for an example

  • Related