Skip to content

Conversation

cabljac
Copy link

@cabljac cabljac commented Aug 22, 2025

Description

fixes firebase/firebase-functions-python#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 cabljac force-pushed the @invertase/merge-process-env branch from 7af4097 to 6d1b70f Compare August 26, 2025 08:43
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.

firestore CREDENTIALS Error when deploying firebase cloud function written in python
1 participant