Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterized configuration is not working with python #6550

Closed
RTae opened this issue Nov 28, 2023 · 3 comments
Closed

Parameterized configuration is not working with python #6550

RTae opened this issue Nov 28, 2023 · 3 comments

Comments

@RTae
Copy link

RTae commented Nov 28, 2023

[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
@aalej
Copy link
Contributor

aalej commented Nov 29, 2023

Hi @RTae, thanks for reaching out and sharing a code snippet along with steps to reproduce the issue. Currently, I’m unable to reproduce the behavior you mentioned. I think the values in your .env.temp file are not being loaded. When running firebase deploy, do you see a log message similar to:

i  functions: Loaded environment variables from .env, .env.temp.

I’m using firebase-tools v12.9.1 to try and replicate this issue. Could you try updating to the latest version to see if there are any changes in behavior when deploying?

@aalej aalej added the Needs: Author Feedback Issues awaiting author feedback label Nov 29, 2023
@google-oss-bot
Copy link
Contributor

Hey @RTae. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@RTae if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

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

No branches or pull requests

3 participants