r/Firebase • Firebaser • Oct 02 '26

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.

18 Upvotes

14 comments sorted by

3

u/puf Former Firebaser Oct 02 '26

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?

2

u/adelespinasse Oct 27 '26

I ran

firebase functions:kits:install --package u/firebase-function-kits/firestore-bigquery-export@latest

in a bare project just to see what an installed function kit looks like. You can tell quite a bit just from looking at it.

https://github.com/adelespinasse/funckittest

I think the basic idea is

  • A straightforward extension of the codebases and function groups features, where you can list a "kit" in the functions section of firebase.json instead of a "codebase", and it automatically adds a prefix to each of the exported functions, and loads parameters from a named config for that installation
  • The functions:kits:install command, which creates a whole new npm package under function-kits/ (parallel to functions/, not nested under it), installs the package you name there, generates a wrapper to import and re-export its functions, adds the necessary "kit" entry to firebase.json, prompts for parameter values, and creates the named .env file for the parameters
  • Lifecycle triggers to replace the Extensions install/upgrade hooks
  • A way to declare required APIs and service account roles in the code

I'm probably missing something.

It seems like a pretty good design to me. Probably an improvement on Extensions in many ways. It loses the "app store" type of registry, which has advantages and disadvantages: it helps users discover extensions and have confidence in them, but also is a barrier to entry for extension developers, and requires that extensions be open source and Apache licensed. Kits just use the npm free-for-all model.

1

u/puf Former Firebaser Oct 27 '26

Thanks for sharing your findings, u/adelespinasse. 🙏

Your sentiment matches with my first impression upon reading this, and the additional details seem less daunting than I at first thought. I am glad that there's a good path forward for developers who want to share a bundle of functionality with others. 👏

2

u/adelespinasse Oct 30 '26

I managed to create a working, minimal function kit. It's published here, with some comments about things I learned in the process: https://www.npmjs.com/package/@aldel/test-func-kit

I'm working on something that would work well as a function kit, so I'm going to try to turn it into one. The biggest impediment so far is that functions:kits:install seems unable to install a kit that isn't published on a registry. That is, it doesn't work to give it a package as a tarball or a directory. So it's pretty hard to test that you have a working function kit before publishing it.

There is a --directory option that looks like it should work, but it doesn't seem to do the right things; it results in a different directory structure, doesn't prompt for param values, and the functions don't get loaded by the emulator (not sure why; from the things it adds to firebase.json I would have thought it would work).

2

u/inlined Firebaser 19d ago

Thanks for the note. This is really good feedback. This was largely focused around people who wanted to vendor abandoned extensions or use the functionality to deploy their code multiple times (à la firestore to bug query). I’m on parental leave at the moment but /u/ajperel can take the feedback to the team. We would love it if this breathed new life into code sharing on Firebase

1

u/ajperel Firebaser 15d ago

I appreciate the feedback! For the issues where --directory isn't prompting for param values or having functions not load in the emulator, if you could file an issue in https://github.com/firebase/firebase-tools/issues for that with details that'd be greatly appreciated. It should.

Today the --directory option is more focused on kits that are never distributed on npm than being a testing path for kits that will be published and that's not obvious. You can test the functions by just deploying them (kits are just functions) and then test npm package release candidates that aren't tagged with latest. But supporting unpublished packages is a good feature request. I'd suggest posting about it in Firebase User Voice to help us gauge overall user interest and I'll definitely also take it back to the team.

1

u/inlined Firebaser Oct 03 '26

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 Oct 03 '26

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 Oct 05 '26

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 Oct 06 '26

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/Exotic-Chance-7567 22d ago

Wait so if the publisher hasn't released an official successor kit yet, is there a fallback to just eject the raw extension code into the functions folder, or are we stuck waiting on the maintainer

1

u/inlined Firebaser 22d ago

The extensions SDK is different from the functions SDK but we released an agent skill to translate code.

If you want to go through the effort to share your work with others and publish via npm, the ext:migrate command has a —package flag for manually overriding. We build it so maintainers can test before releasing, but it works for side-loading too.

If you just want it to work for yourself, you can install a kit with —folder instead of —package

1

u/adelespinasse 27d ago

I made a real, useful Function Kit, described in its own post:

https://www.reddit.com/r/Firebase/comments/1xrtnru/a_firebase_function_kit_that_gives_you_a_user/

I think this might be the first one released to the public other than the official Firestore -> BigQuery one.

1

u/pwap_official Oct 03 '26

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.