Skip to content

Parameterized configuration is not working with python #6550

@RTae

Description

@RTae

[REQUIRED] Environment info

firebase-tools: 12.5.2

Platform: macOS

[REQUIRED] Test case

Change runtime optional in each environment by using dotenv file

[REQUIRED] Steps to reproduce

  1. Create two dotenv file, which are .env and .env.temp
  2. Set variables into .env and .env.temp, let keep track on variable PROJECT_ID
    2.1 .env : PROJECT_ID=local
    2.2 .env.temp : PROJECT_ID=temp
  3. Run firebase use temp
  4. Run firebase deploy

[REQUIRED] Expected behavior

It must use PROJECT_ID in each environment; in this case must be PROJECT_ID=temp

[REQUIRED] Actual behavior

it use environment variable from .env file, .env.temp does not overwrite the default configuration

Example code

from firebase_functions import pubsub_fn, params
import os

REGION = os.environ.get("REGION")
PUBSUB_TOPIC_NAME = os.environ.get("PUBSUB_TOPIC_NAME")
PROJECT_ID = params.StringParam("PROJECT_ID")

@pubsub_fn.on_message_published(
    topic=PUBSUB_TOPIC_NAME,
    region=REGION,
    service_account=f"test@{PROJECT_ID}.iam.gserviceaccount.com",
    memory=16384,
    timeout_sec=540,
    cpu=8,
)
def Test(
    event: pubsub_fn.CloudEvent[pubsub_fn.MessagePublishedData],
) -> None:
   # Code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions