firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

Cannot Deploy Firestore Trigger Function with timeoutSeconds: 3600 (Error: Max 540s)

Open tanabee opened this issue 2 months ago • 5 comments

Related issues

none

[REQUIRED] Version info

node: v22.14.0

firebase-functions: 6.4.0

firebase-tools: 14.17.0

firebase-admin: 12.6.0

[REQUIRED] Test case

I tryed the source code below.

module.exports.onwrite = onDocumentWritten(
  {
    document: 'segments/{id}',
    timeoutSeconds: 3600,
  },
  async event => {
    console.log('test')
  }
)

[REQUIRED] Steps to reproduce

When I try to deploy a Firestore trigger function with timeoutSeconds set to 3600, I get a deployment error.

[REQUIRED] Expected behavior

According to the official documentation, it should be possible to deploy successfully with a value of 3600.

Documentation: https://firebase.google.com/docs/functions/quotas#time_limits:~:text=60%20minutes%20for%20HTTP%20functions.%0A60%20minutes%20for%20event%2Ddriven%20functions. https://cloud.google.com/functions/quotas#time_limits

[REQUIRED] Actual behavior

It occurs the error below.

⚠  functions: Request to https://cloudfunctions.googleapis.com/v2/projects/[project id]/locations/[region]/functions?functionId=firestore-segment-onwrite had HTTP Error: 400, The timeout for functions with an event trigger cannot exceed 540 seconds.

Were you able to successfully deploy your functions?

No

tanabee avatar Sep 27 '25 06:09 tanabee

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

google-oss-bot avatar Sep 27 '25 06:09 google-oss-bot

Hi! Thanks for raising this. It's been received and we will provide updates when available.

cabljac avatar Sep 29 '25 16:09 cabljac

Reproduced

MRE

CorieW avatar Oct 01 '25 12:10 CorieW

Is there a workaround?

stefanodecillis avatar Nov 16 '25 19:11 stefanodecillis

I noticed that there's this comment in the code:

The minimum timeout for a gen 2 function is 1s. The maximum timeout for a function depends on the type of function: Event handling functions have a maximum timeout of 540s (9 minutes). HTTPS and callable functions have a maximum timeout of 3,600s (1 hour). Task queue functions have a maximum timeout of 1,800s (30 minutes)

There seems to be a discrepancy between here and the docs.

CorieW avatar Nov 19 '25 14:11 CorieW