Skip to content

Bug: firebase functions:delete fails for onTaskDispatched function, attempts to create a queue #9305

@solkennedy

Description

@solkennedy

[REQUIRED] Environment Info

  • firebase-tools version: 14.19.1
  • Platform: macOS

[REQUIRED] Test Case

Minimal reproducible example.

[REQUIRED] Steps to Reproduce

  1. Define a simple Gen 2 onTaskDispatched function in functions/index.js without taskQueueOptions. This causes the Firebase deployer to auto-create a queue with the same name as the function.

    // functions/index.js
    const { onTaskDispatched } = require("firebase-functions/v2/tasks");
    
    exports.myTaskFunction = onTaskDispatched({
      region: "us-central1",
    }, (req) => {
      console.log("Executed myTaskFunction");
    });
  2. Deploy this function: firebase deploy --only functions:myTaskFunction. This will succeed and create both the function myTaskFunction and a Cloud Tasks queue also named myTaskFunction.

  3. Go to the Google Cloud Console -> Cloud Tasks and manually delete the myTaskFunction queue.

  4. Wait a minute.

  5. Attempt to delete the function using the CLI: firebase functions:delete myTaskFunction.

[REQUIRED] Expected Behavior

The firebase functions:delete command should successfully delete the myTaskFunction Cloud Function and its associated resources (Cloud Run service, Eventarc trigger) without attempting to create any new resources.

[REQUIRED] Actual Behavior

The firebase functions:delete command fails. It incorrectly attempts to make a CreateQueue API call for a queue with the same name as the function. This fails with a 400 error because the queue name existed too recently. Function cannot be deleted from CLI.

Terminal Output:

firebase functions:delete myTaskFunction   
✔ You are about to delete the following Cloud Functions:
        myTaskFunction(us-central1)
  Are you sure? Yes
i  functions: deleting Node.js 20 (2nd Gen) function myTaskFunction(us-central1)...
Request to https://cloudtasks.googleapis.com/v2/projects/PROJECT/locations/us-central1/queues/myTaskFunction?updateMask=name%2Cstate had HTTP Error: 400, The queue cannot be created because a queue with this name existed too recently.

Functions deploy had errors with the following functions:
        myTaskFunction(us-central1)

This shows that a delete command is incorrectly triggering a create or update operation on a related but separate resource.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions