Skip to content

feat: inject FIREBASE_KIT_INSTANCE_ID environment variable for function kits - #10906

Open
ajperel wants to merge 1 commit into
mainfrom
ajp/kit-deploy-with-id-env-var
Open

feat: inject FIREBASE_KIT_INSTANCE_ID environment variable for function kits#10906
ajperel wants to merge 1 commit into
mainfrom
ajp/kit-deploy-with-id-env-var

Conversation

@ajperel

@ajperel ajperel commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

This change ensures that when deploying or emulating functions that belong to a Kit codebase, an environment variable FIREBASE_KIT_INSTANCE_ID is automatically injected into the process containing exactly the kit instance string identifier.

This mirrors how variables like FIREBASE_CONFIG and GCLOUD_PROJECT are orchestrated through loadFirebaseEnvs() and prevents the developer from manually mapping these contexts. The variable remains omitted if the user is deploying a standard codebase.

Scenarios Tested

  • Deployed multiple kits which contain functions that log and return their instance ids showing correct behavior.
  • Deployed a non-kit codebase with the kits experiment on and off
  • Run all tests

Sample Commands

  • npm run test
  • firebase deploy --only functions

…on kits

### Description
This change ensures that when deploying or emulating functions that belong to a Kit codebase, an environment variable `FIREBASE_KIT_INSTANCE_ID` is automatically injected into the process containing exactly the kit instance string identifier.

This mirrors how variables like `FIREBASE_CONFIG` and `GCLOUD_PROJECT` are orchestrated through `loadFirebaseEnvs()` and prevents the developer from manually mapping these contexts. The variable remains omitted if the user is deploying a standard codebase.

### Scenarios Tested
- Deployed multiple kits which contain functions that log and return their instance ids showing correct behavior.
- Deployed a non-kit codebase with the kits experiment on and off
- Run all tests

### Sample Commands
- `npm run test`
- `firebase deploy --only functions`

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for passing the FIREBASE_KIT_INSTANCE_ID environment variable to Firebase Functions kit instances during deployment preparation and emulator startup. It updates loadFirebaseEnvs to accept an optional kitInstanceId and includes corresponding unit tests to verify the behavior. I have no additional feedback to provide as the changes are well-implemented and covered by tests.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants