Skip to content

Deleting a v2 auth blocking function leaves its Identity Platform registration behind after the function has been updated #11532

Open

Description

@elekom

[REQUIRED] Environment info

firebase-tools: 14.27.0 (delete) / 15.18.0 (update deploy)

Platform: Ubuntu (GitHub Actions)

[REQUIRED] Test case

const { beforeSmsSent } = require("firebase-functions/v2/identity");

exports.authBlocking = {
  beforeSmsSent: beforeSmsSent(() => {}),
};

[REQUIRED] Steps to reproduce

  1. firebase deploy --only functions (creates the function).
    GET https://identitytoolkit.googleapis.com/admin/v2/projects/<project>/config now shows
    blockingFunctions.triggers.beforeSendSms.functionUri = https://<region>-<project>.cloudfunctions.net/authBlocking-beforeSmsSent
  2. Change the function (e.g. add a log line) and run firebase deploy --only functions again (updates the function).
    functionUri is now https://authblocking-beforesmssent-<hash>-<region-code>.a.run.app
  3. firebase --debug functions:delete authBlocking.beforeSmsSent --force
  4. GET .../admin/v2/projects/<project>/config again.

[REQUIRED] Expected behavior

The function is deleted and its beforeSendSms registration is removed.

[REQUIRED] Actual behavior

The function is deleted, but the beforeSendSms registration is left pointing at the deleted function's run.app URL, so every SMS send (phone sign-in) fails until the registration is removed manually. If the function is deleted right after step 1 (never updated), the registration is removed correctly.

The debug log shows the CLI reading the config, finding the run.app URL registered, and deleting the function without updating the config (project ID and hash replaced, response bodies trimmed):

$ firebase --debug functions:delete authBlocking.beforeSmsSent --force
...
[2026-11-12T01:45:23.437Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v2/projects/my-project/locations/-/functions 200
[2026-11-12T01:45:23.445Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v2/projects/my-project/locations/-/functions {"functions":[..., {"name":"projects/my-project/locations/asia-northeast1/functions/authBlocking-beforeSmsSent", ..., "url":"https://asia-northeast1-my-project.cloudfunctions.net/authBlocking-beforeSmsSent", "serviceConfig":{..., "uri":"https://authblocking-beforesmssent-xxxxxxxxxx-an.a.run.app"}, "environment":"GEN_2"}, ...]}
i  functions: deleting Node.js 22 (2nd Gen) function authBlocking-beforeSmsSent(asia-northeast1)...
[2026-11-12T01:45:23.561Z] >>> [apiv2][query] GET https://identitytoolkit.googleapis.com/admin/v2/projects/my-project/config [none]
[2026-11-12T01:45:23.723Z] <<< [apiv2][status] GET https://identitytoolkit.googleapis.com/admin/v2/projects/my-project/config 200
[2026-11-12T01:45:23.723Z] <<< [apiv2][body] GET https://identitytoolkit.googleapis.com/admin/v2/projects/my-project/config {..., "blockingFunctions":{"triggers":{"beforeSendSms":{"functionUri":"https://authblocking-beforesmssent-xxxxxxxxxx-an.a.run.app","updateTime":"2026-11-12T01:16:16.614Z"}},"forwardInboundCredentials":{}}, ...}
[2026-11-12T01:45:23.724Z] >>> [apiv2][query] DELETE https://cloudfunctions.googleapis.com/v2/projects/my-project/locations/asia-northeast1/functions/authBlocking-beforeSmsSent [none]
[2026-11-12T01:45:24.809Z] <<< [apiv2][status] DELETE https://cloudfunctions.googleapis.com/v2/projects/my-project/locations/asia-northeast1/functions/authBlocking-beforeSmsSent 200
...
✔  functions[authBlocking-beforeSmsSent(asia-northeast1)] Successful delete operation.

There is no request to update the Identity Platform config after the GET.

Activity

  1. IzaakGough commented on Nov 17, 2026

    @IzaakGough
    Contributor

    Hi @elekom thanks for raising this. We will review as soon as possible.

  2. aalej commented on Nov 17, 2026

    @aalej
    Contributor

    Thanks for the clear steps to reproduce the issue and for sharing your findings, @elekom! I was able to reproduce the reported behavior. A beforeSmsSent function that has been updated does not get properly deleted by functions:delete. As you noted, this causes Phone number Authentications to fail since blockingFunctions.triggers.beforeSendSms still exists and points to a non-existent function. Sharing mcve here - https://github.com/aalej/issues-11532

    It looks like you should be able to remove the function from blockingFunctions.triggers.beforeSendSms, by doing the ff:

    1. Re-deploy the function (which creates the function again and syncs the config)
    2. Running functions:delete on this newly created function

    Marking this as reproducible and will raise this to our engineering team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions