0

We are sending an axios request to python (which is running in cloud RUN) from node js application (hosted in Google app engine), python (flask) app takes more time to respond in some cases. When it (python) takes more than 10 mins to send the response back, the response doesn't come and the application hangs up. Python sends the response in all cases with status code 200.

I am getting the log statement "before axios" always, but not getting another log, if request takes longer (more than 10 mins) to respond.

We even tried to send the request via request library (instead of axios), as well as by using

   axios(config)
          .then()
.catch()

Here is the code snippet;

var try_data = {
                "name" : "abc",
"age": 67
            }

 var config = {
                method: 'post',
                url: `https:/python/results`,
                headers: {
                    'Content-Type': 'application/json'
                },
                data: try_data,
                timeout: 3600000
            };
            console.log("just before axios")

            var optimised_result = await axios(config)
console.log(optimised_result);
console.log("after axios")
Akshita
  • 1
  • 1

1 Answers1

0

The request timeout setting specifies the time within which a response must be returned by services deployed to Cloud Run. If a response isn't returned within the time specified, the request ends and error 504 is returned.

The timeout is set by default to 5 minutes and can be extended up to 60 minutes.

You can read more about request timeouts for Cloud Run here.

In addition to changing the Cloud Run request timeout, you should also check your language framework to see whether it has its own request timeout setting that you must also update. It is possible that Python itself or Flask has limitations on the timeouts that might be affecting the socket in terms of closing it.

Roger
  • 27
  • 6