The timeout has always been 540 seconds. See (and note the dates):
If you need more time for a background/async execution, you can either break up your function into different parts, or you can use a different product, such as Cloud Run. There is a full example of how to do that.
You could also arrange to use App Engine or Compute Engine to stand up a server.
For anyone else having this issue, in the openapi-functions.yaml under the x-google-backend you should had the attribut deadline and set it to whatever value in seconds you want.
Here is the hidden documentation https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#deadline
Issue related: https://github.com/GoogleCloudPlatform/esp-v2/issues/4
Even though a timeout is not reported as an error, you can still set up a metric for timeout log entries, and then an alert on the metric exceeding a zero threshold.
resource.type="cloud_function"
resource.labels.function_name="[YOUR_FUNCTION_NAME_HERE]"
"finished with status: timeout"
The third line is a "contains" text filter. Timeout messages consistently contain this text. You can add other things or modify as needed.
Click Create Metric. Give the metric a name like "Function timeouts", and make sure the type is counter. You can leave the optional fields blank. Submit the form, and you should be redirected to /logs/metrics.
Under User-defined Metrics, you should see your new metric. Click the three-dot button on the right and select Create alert from metric.
Give the alert policy a meaningful name. Under target, you may also get some red text about being unable to produce a line plot. Click the helpful link to switch the aligner to mean and the aggregator to none. Then under Configuration, set the condition to "is above," threshold to "0", and for "most recent value."
Proceed with building the notification and documentation as desired. Make sure you add a notification channel so you get alerted. The UI should include hints on each field.
More detail is in the official documentation.
Cloud Function execution time is limited by the timeout duration, which you can specify at function deployment time. By default, a function times out after 1 minute. As it is stated in the official documentation:
When function execution exceeds the timeout, an error status is immediately returned to the caller. CPU resources used by the timed-out function instance are throttled and request processing may be immediately paused. Paused work may or may not proceed on subsequent requests, which can cause unexpected side effects.
Note that this period can be extended up to 9 minutes. In order to set the functions timeout limit you can use this gcloud command:
gcloud functions deploy FUNCTION_NAME --timeout=TIMEOUT FLAGS...
More details about your options could be found over here. But, maybe if your code takes a long time to execute, you may also consider using another serverless option, like Cloud Run.
An alternative is to use Cloud Run (you only need to add a webserver and to build a standard container. If you share your language, I can provide you examples). Cloud Run has the same behavior as Cloud Function (if you set the concurrency to 1) and can handle request up to 60 minutes.
However, be careful of Cloud Scheduler. It is able to handle request only up to 30 minutes, after, it considers the request as failed because of timeout. But, the Cloud Run request can continue correctly up to 60 minutes (after Cloud Run stops the processing). In this case, don't set up retry policy on your Cloud Scheduler and let the Cloud Run continue its processing a full hour. The bad side of that is that you can't use Cloud Scheduler retry policy in case of real error.