firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

fix: propagate process.env to Python runtime serveAdmin environment

Open cabljac opened this issue 4 months ago • 0 comments

Description

fixes https://github.com/firebase/firebase-functions-python/issues/126

The Python runtime's serveAdmin method was not including process.env when spawning the admin server process.

This caused important environment variables like GOOGLE_APPLICATION_CREDENTIALS to be lost, which breaks authentication and configuration in Python functions, especially during code discovery phase.

Proposed Solution

add ...process.env to the environment object in serveAdmin, to ensure all current process environment variables are inherited by the Python admin server process.

Changes

  • Added ...process.env spread to envWithAdminPort object in serveAdmin method
  • Added: test coverage in src/deploy/functions/runtimes/python/index.spec.ts

Scenarios Tested

  • Environment Variable Propagation: Verified that process.env variables (including GOOGLE_APPLICATION_CREDENTIALS) are properly passed to Python admin server
  • Empty Environment Handling: Tested that when no additional envs are provided, process.env is still preserved
  • Environment Override: Verified that provided environment variables correctly override process.env when there are conflicts
  • CI Environment: Reproduction tested in CI environment with GOOGLE_APPLICATION_CREDENTIALS authentication

MRE in CI environment (you can use act to run locally) here

TODO: test compatibility deploying it not in CI

cabljac avatar Aug 22 '25 11:08 cabljac