Setting request timeout

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.

By default, the timeout is set to 5 minutes. You can change this setting when you deploy a container image or by updating the service configuration.

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. For example, Node.js developers need to update the server.timeout property.

Setting and updating request timeout

You can set the request timeout using the gcloud command-line tool.

Console

  1. Go to Cloud Run

  2. Click CREATE SERVICE if you are setting request timeout on a new service you are deploying to. If you are setting the timeout on an existing service, then click on the service, then click DEPLOY NEW REVISION.

  3. Click SHOW OPTIONAL SETTINGS:

    set request timeout

    Specify the desired timeout value in the Request timeout textbox, in seconds. using values from 1 to 900 seconds (15 minutes).

  4. Click Create or Deploy.

Command line

You can update the request timeout for a given revision at any time by using the following command:

gcloud beta run services update [SERVICE] --timeout=[TIMEOUT]

Replace

  • [SERVICE] with the name of your service.
  • [TIMEOUT] with the desired time, using an integer value or an absolute duration value, for example 1m20s which is 1 minute, 20 seconds. If you use an integer value, the unit is assumed to be seconds. The value you specify must be less than 15 minutes.

You can also set the request timeout during deployment using the command:

gcloud beta run deploy --image gcr.io/[PROJECT-ID]/[IMAGE] --timeout=[TIMEOUT]

Replace

  • [PROJECT-ID] with your GCP project ID.
  • [IMAGE] with the name of your image.
  • [TIMEOUT] with the desired time, using an integer value or a duration value, for example 1m20s which is 1 minute, 20 seconds. If you use an integer value, the unit is assumed to be seconds. The value you specify must be less than 15 minutes.
Оцените, насколько информация на этой странице была вам полезна:

Оставить отзыв о...

Текущей странице
Cloud Run Documentation