Search code examples
google-cloud-functionsfirebase-hosting

Create a Cloud Function that is sensitive to the deployment of a new version in Firebase Hosting?


I am trying to implement a function that will be triggered once a new version has been released—in other words, once my Firebase deployment finishes deploying all the changes. Does Firebase support such a possibility? I want to enable live updates for my app once I release a new version.

// on new version release
exports.onHostingRelease = functions
  .runWith({ timeoutSeconds: 540, memory: '2GB' })
  .hosting.site('your-site-name')
  .onRelease((versionMetadata) => {
    // versionMetadata is an object that contains information about the new version
    console.log('New version deployed:', versionMetadata.versionString);

    // You can perform any actions you need here, such as sending a notification
    // or updating a database record

    return null;
  });


Solution

  • All supported Firebase triggers are listed and described under the "Trigger background functions" section of the document in the left navigation you see in the documentation. As of this writing, there are no triggers for Firebase Hosting.

    Feel free to send feedback to Firebase support with your feature request.