skip to Main Content

This Firebase blog post says that Gen 2 functions are available from 7/31/23, but when I try to firebase deploy one of them, I get this error:

Error: [callGroupRTDBSetup(us-central1)] Upgrading from GCFv1 to GCFv2 is not yet supported. Please delete your old function or wait for this feature to be ready.

A few days ago I recreated my project from scratch, doing firebase init all over again. I think the only thing I might not have updated is Node.js. Today I ran npm update -g firebase-tools because it told me there was an update available. I also restarted my computer. My firebase --version is now 12.4.7.

import {onCall} from "firebase-functions/v2/https";

exports.callGroupRTDBSetup = onCall({cors: true}, async (req) => {
  try {
    const groupID = req.data.groupID;
    const adminUID = req.data.adminUID;
    const adminUsername = req.data.adminUsername;
    const createdTimestamp = req.data.createdTimestamp;

    await setGroupAdminRTDB(groupID, adminUID, adminUsername, createdTimestamp);

    await addMemberRTDB(groupID, adminUID, adminUsername, createdTimestamp);

    return {
      returnVal: 1,
      returnMsg: "callGroupRTDBSetup success!",
    };
  } catch (error) {
    throw new HttpsError("invalid-argument", "Error: " + error);
  }
});

2

Answers


  1. As explained in the documentation:

    It is not possible to upgrade a function from 1st to 2nd gen with the
    same name
    and run firebase deploy. Doing so will result in the error:

    Upgrading from GCFv1 to GCFv2 is not yet supported. Please delete your
    old function or wait for this feature to be ready.

    Login or Signup to reply.
  2. If you have a function you don’t mind deleting, just delete it and redeploy.

    firebase functions:delete myFunction
    
    firebase deploy --only functions:myFunction
    

    Here is the documentation for this error message.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search