how to solve gcloud app deploy network connectivity error?

Viewed 1184

When I try to deploy my Django project on Google App Engine with command:

gcloud app deploy

then i got network connectivity error every time. Error massage is:

ERROR: (gcloud.app.deploy) EOF occurred in violation of protocol (_ssl.c:661)
This may be due to network connectivity issues. Please check your network settings, and the status of the service you are trying to reach.

I try google but not solve it. Please anyone help me.

My app.yaml file is:

runtime: python37

entrypoint: gunicorn -b :8080 scanner_api.wsgi

handlers:
  # This configures Google App Engine to serve the files in the app's static
  # directory.
- url: /static
  static_dir: static

  # This handler routes all requests not caught above to your main app. It is
  # required when static routes are defined, but can be omitted (along with
  # the entire handlers section) when there are no static files defined.
- url: /.*
  script: auto
3 Answers

Try after lowering the number of parallel tasks by setting GAM_THREADS environment variable:

$env:GAM_THREADS=5

If you get the same error, keep it lowering by 4,3,2 ...

try gcloud app deploy --log-http you may get more information about the error

Try changing your network too if nothing help...like mobile hotspot!!

Please include other relevant data including source(s), requirements.txt etc.

Using the gunicorn exemplar app:

main.py:

def app(environ, start_response):
        data = b"Hello, World!\n"
        start_response("200 OK", [
            ("Content-Type", "text/plain"),
            ("Content-Length", str(len(data)))
        ])
        return iter([data])

NB source is main.py and function is app

and:

app.yaml:

runtime: python37

entrypoint: gunicorn -b :${PORT} main:app

NB Using :${PORT} rather than explicit :8080 per recommendation

NB main:app from source (main.py) and function (app)

Because of the explicity entrypoint: gunicorn, gunicorn in requirements.txt:

gunicorn==20.0.4

Deploy and test:

gcloud app deploy app.yaml \
--project=${PROJECT} \
--region=${REGION}

curl \
--request GET \
https://${PROJECT}.appspot.com
Hello, World!

Your openssl is either missing or out of date. Run:

python -m pip install pyopenssl

and try again.

Related