Skip to content

Cannot deploy Firestore trigger function with timeoutSeconds > 540 on first deployment, but update succeeds #9486

@MasaGon

Description

@MasaGon

[REQUIRED] Environment info

firebase-tools: 13.x (latest)

Platform: Linux (WSL2)

Node.js version: 22.19.0

firebase-functions: v2

[REQUIRED] Test case

import { onDocumentCreated } from 'firebase-functions/v2/firestore'

export const processAsyncJobs = onDocumentCreated(
  {
    document: 'asyncJobs/{jobId}',
    timeoutSeconds: 3600, // 60 minutes
    region: 'asia-northeast1',
  },
  async (event) => {
    // Long-running async job processing
  }
)

[REQUIRED] Steps to reproduce

  1. Create a Firestore trigger function with timeoutSeconds: 3600
  2. Run firebase deploy --only functions:processAsyncJobs
  3. First deployment fails with error: "The timeout for functions with an event trigger cannot exceed 540 seconds"
  4. Change timeoutSeconds: 540 and deploy successfully
  5. Change back to timeoutSeconds: 3600 and deploy again
  6. Second deployment succeeds without error

[REQUIRED] Expected behavior

[REQUIRED] Actual behavior

First deployment with timeoutSeconds: 3600:

⚠  functions: Request to https://cloudfunctions.googleapis.com/v2/projects/PROJECT_ID/locations/asia-northeast1/functions?functionId=processAsyncJobs had HTTP Error: 400, The timeout for functions with an event trigger cannot exceed 540 seconds.
⚠  functions:  failed to create function projects/PROJECT_ID/locations/asia-northeast1/functions/processAsyncJobs
Failed to create function projects/PROJECT_ID/locations/asia-northeast1/functions/processAsyncJobs

Workaround:

  1. Deploy with timeoutSeconds: 540 → succeeds
  2. Update to timeoutSeconds: 3600 and deploy again → succeeds
  3. Function runs with 60-minute timeout in production

Additional Notes:

  • This appears to be a validation issue during initial function creation
  • Subsequent deployments (updates) accept 3600 seconds without error
  • The deployed function successfully runs with the 60-minute timeout
  • The same limitation applies to both onDocumentCreated and onMessagePublished triggers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions