Configure request timeout for services Stay organized with collections Save and categorize content based on your preferences.
If a service runs for too long, the system takes steps to terminate or throttleit.
For Cloud Run services, the request timeout setting specifies thetime within which a response must be returned by services deployed toCloud Run. If a response isn't returned within the time specified, thenetwork connection to the service will be closed and an error 504 is returned.Note that the container instance that served the request is not terminated.The container or code might keep processing the terminated request and mighthave its execution time interfere with processing other requests. To avoid this,prevent timeouts in your service with the following techniques:
- Set a timeout higher than your expected execution time.
- Track the amount of time left during execution. Then perform cleanup andreturn early.
Timeout period for services
The timeout is set by default to 5 minutes(300 seconds) and can be extended up to60 minutes(3600 seconds).
When triggering your service fromEventarc events,Pub/Sub push subscriptionsorCloud Scheduler, the timeoutof these services apply.
Important: For a timeout longer than 15 minutes, Googlerecommends implementing retries and making sure the service is tolerant toclients re-connecting in case the connection is lost (either by ensuring requestsare idempotent, or by designing request handlers in such a way that they canresume from the point where they left off).The longer the timeout is, the more likely the connection can be lost due tofailures on the client side or the Cloud Run side.When a client re-connects, a new request is initiated and the client isn'tguaranteed to connect to the same instance of the service.You can change this setting when you deploy a container image or by updatingthe service configuration.
In addition to changing the Cloud Run request timeout, you should alsocheck your language framework to see whether it has its own request timeoutsetting that you must also update. Some clients of the Cloud Runservice might also impose a more restrictive timeout.
Required roles
To get the permissions that you need to configure and deploy Cloud Run services, ask your administrator to grant you the following IAM roles:
- Cloud Run Developer (
roles/run.developer) on the Cloud Run service - Service Account User (
roles/iam.serviceAccountUser) on the service identity
If you are deploying aserviceorfunction from source code, youmust also have additional roles granted to you on your project andCloud Build service account.
For a list of IAM roles and permissions that are associated withCloud Run, seeCloud Run IAM rolesandCloud Run IAM permissions.If your Cloud Run service interfaces withGoogle Cloud APIs, such as Cloud Client Libraries, see theservice identity configuration guide.For more information about granting roles, seedeployment permissionsandmanage access.
Set and update request timeout
Any configuration change leads to thecreation of a new revision. Subsequent revisions will also automatically getthis configuration setting unless you make explicit updates to change it.
You can set request timeout using the Google Cloud console, the gcloud CLIcommand line, or a YAML file when youcreate a new service ordeploy a new revision.
Console
In the Google Cloud console, go to Cloud Run:
SelectServices from the Cloud Run navigation menu, and clickDeploy container to configure a new service.If you are configuring an existing service, click theservice, then clickEdit and deploy new revision.
If you are configuring a new service, fill out the initial servicesettings page, then clickContainer(s), Volumes, Networking, Security to expand theservice configuration page.
Click theContainer tab.

- In theRequest timeout field, enter the timeout value that you want to use in seconds. Use values ranging from
1to3600seconds, or from 1 to60minutes.
- In theRequest timeout field, enter the timeout value that you want to use in seconds. Use values ranging from
ClickCreate orDeploy.
gcloud
You canupdate the request timeoutfor a given revision at any time by using the following command:
gcloudrunservicesupdateSERVICE--timeout=TIMEOUTReplace the following:
- SERVICE: the name of your service.
TIMEOUT: the time within which a response must bereturned, using an integer value or anabsolute duration value—forexample
Note: When you update your service with the new timeout value, a newrevision is created.1m20swhich is 1 minute, 20 seconds. If youuse an integer value, the unit is assumed to be seconds. The value youspecify must be less than 60 minutes.
You can also set the request timeout duringdeployment using the command:
gcloudrundeploy--imageIMAGE_URL--timeout=TIMEOUTReplace the following:
- IMAGE_URL: a reference to the container image, forexample,
us-docker.pkg.dev/cloudrun/container/hello:latest. If you use Artifact Registry,therepositoryREPO_NAME mustalready be created. The URL follows the format ofLOCATION-docker.pkg.dev/PROJECT_ID/REPO_NAME/PATH:TAG. - TIMEOUT: the time within which a response must bereturned, using an integer value or a duration value—for example,
1m20swhich is 1 minute, 20 seconds. If you use an integer value, the unit isassumed to be seconds. The value you specify must be less than60 minutes.
YAML
If you are creating a new service, skip this step.If you are updating an existing service, download itsYAML configuration:
gcloudrunservicesdescribeSERVICE--formatexport>service.yamlUpdate the
timeoutSecondsattribute:apiVersion:serving.knative.dev/v1kind:Servicemetadata:name:SERVICEspec:template:spec:containers:-image:IMAGEtimeoutSeconds:VALUE
Replace the following:
- SERVICE: the name of your Cloud Run service.
- IMAGE_URL: a reference to the container image, forexample,
us-docker.pkg.dev/cloudrun/container/hello:latest. If you use Artifact Registry,therepositoryREPO_NAME mustalready be created. The URL follows the format ofLOCATION-docker.pkg.dev/PROJECT_ID/REPO_NAME/PATH:TAG. - VALUE: the chosen timeout, in seconds.
Create or update the service using the following command:
gcloudrunservicesreplaceservice.yaml
Terraform
To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.
Add the following to agoogle_cloud_run_v2_service resource in your Terraform configuration:resource"google_cloud_run_v2_service""default"{name="cloudrun-service-request-timeout"location="us-central1"deletion_protection=false # set to "true" in productiontemplate{containers{image="us-docker.pkg.dev/cloudrun/container/hello"} # Timeouttimeout="300s"}}Replace300s with your service's chosen request timeout.
View request timeout settings
To view the current request timeout settings for yourCloud Run service:
Console
In the Google Cloud console, go to the Cloud RunServices page:
Click the service you are interested in to open theService detailspage.
Click theRevisions tab.
In the details panel at the right, the request timeout settingis listed under theContainer tab.
gcloud
Use the following command:
gcloudrunservicesdescribeSERVICE
Locate the request timeout setting in the returnedconfiguration.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.