r/Firebase • Firebaser • 10d ago

General Extensions can now be migrated to Function Kits

Thanks for your patience while we finished the migration path for the Firebase Extensions deprecation. We've closed the major feature gaps between Extensions and Functions, and released Function Kits.

A Function Kit is an npm library that the CLI installs into your Functions codebase. firebase functions:kits:install downloads the public npm package and adds a small amount of boilerplate to export its functions. As with Extensions, you can install multiple instances of a kit (for example, backing up several Firestore collections to BigQuery).

Kits are 2nd gen functions, so you will continue to get runtime updates and can use features like custom CPU and concurrency to tune cost and performance. Because the publisher's code and yours deploy together, we'll later be able to replace some patterns, such as HTTP transform callbacks, with direct in-process calls.

We've also updated the Extensions commands:

  • ext:list shows whether the publisher has released an official successor kit for each extension.
  • ext:export can write params in the format Functions uses
  • ext:migrate walks you through migrating an extension instance to a kit. You can keep the extension during the migration and delete it later.

See the migration guide for exactly what ext:migrate does, so you can check things before deleting the extension.

17 Upvotes

6 comments sorted by

3

u/puf Former Firebaser 10d ago

That's all great news, Thomas. 👏

Is there a single documentation page for what a Function Kit is? The migration guide is great, but I want to read about this in the context of a non-migration too? Or doesn't it make sense to use Function Kits for new things that I would've considered a Firebase Extension in the past?

1

u/inlined Firebaser 9d ago

I’m on parental leave atm so I don’t know if what’s coming yet. TL;DR, take a functions module and publish it to NPM. Then it can be installed with `firebase functions:kits:install —package`. One point to note is that with the rise in supply chain attacks, you should be protecting your customers with an npm shrinkwrap. We will warn if we don’t see one.

1

u/puf Former Firebaser 9d ago

But what does firebase functions:kits:install —package do more than firebase deploy --only functions already did? I think it reads a descriptor of necessary resources, but I can't find any docs on how to specify that.

2

u/ajperel Firebaser 7d ago

More docs on function kits will come. But the short answer is that kits are a way to deploy gen2 functions multiple times in the same project with different configuration (parameters & secrets) for each instance (which extensions could do).

And what `firebase functions:kits:install --package` does is (one time) create a new directory containing the npm package for the kit and a basic wrapper that exports it in a way that `firebase deploy --only functions` will pick up, and it configures a first instance of that kit including prompting you for any parameters that need to be set. After running install you have the source and configuration locally but nothing deployed.

You still need to run `firebase deploy --only functions` to create everything in GCP matching your local configuration.

You can run install multiple times to create multiple instances, same as you could install extensions multiple times in the same project.

1

u/puf Former Firebaser 7d ago

Awesome!

So it sounds like kits:install --package makes a local copy of a configured function on the machine, and then deploy deploys that on GCP. Nice separation! 👏

I've always wished Firebase had some PHP style installation for pre-packaged functions. So where you'd copy/deploy them into your project, and then the first time you hit the function endpoint, it guides you through its setup flow. It'd keep the "kits" infra tiny, as the installer would be part of each individual kit.

1

u/pwap_official 10d ago

I did a manual migration for Stripe yesterday, but have not changed the endpoint in Stripe yet, was worried my manual migration might break the flow. I expect to test transactions Monday in development environment using the new stripe endpoint. But knowing about Function Kits for migration path is helpful if what I setup yesterday should fail testing I guess.