-
Notifications
You must be signed in to change notification settings - Fork 201
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
Custom Parameters while Deploying Functions or Serving Functions #1369
Comments
Hi @rohitgarg-lenskart, thanks for reaching out about this issue. We've noticed that many developers like yourself are expecting to be able to parametrize various configuration options that are currently not supported. We are working on expanding the parametrization feature to include all functions configuration options. Stay tuned for those changes! |
I see some PRs getting merged around the |
Hi @blidd-google , most of the config options now support |
Can we get |
This is a real shortcoming of the functions API. It's a common use case to have different buckets between environments. If a fix isn't coming soon then an alternative should be documented. |
Has this issue been resolved? I cannot find solution anywhere . I really would prefer not to have to hardcode those values as they vary depending on the environment... EDIT: Got it somewhat to work using dotenv and regular env file. Not ideal, and definitely not ideal that documentation and cli prompts indicated a feature that doesnt work/exist. |
Currently we can't access custom parameters while deployment of functions or while serving functions locally. Only a few selected params are allowed. e.g. minInstance
Can we expect custom parameters to be added, to access while deployment or while serving.
Unlike, this issue firebase/firebase-tools#5524, where few of the values are only added to params.
Even, the most basic thing used by functions "region" is still not added, and functions.config() is deprecated, just to make things tough for the users?
If any alternatives to access custom parameters while deployment, please provide.
Use Case 1: Need to select different regions to deploy functions based on parameters.
Use Case 2: Need to select different environment and a lot of pre-deployment conditions are dependent upon the environment being selected. eg.functions.storage.bucket("bucket-name").object().onFinalize, here bucket name can be different for different projects, and the bucket name has to given while deployment itself.
Related issues
firebase/firebase-tools#5524
#1084
firebase/firebase-tools#5347
[REQUIRED] Version info
node: 18.12.1
firebase-functions: 4.2.1
firebase-tools: 11.19.0
firebase-admin: 11.5.0
[REQUIRED] Test case
const envParam = param.defineString("APP_ENV")
const bucketName = envParam.equals("dev").thenElse("dev-bucket-name", "prod-bucket-name")
//or const bucketName = envParam.equals("dev").thenElse("dev-bucket-name", "prod-bucket-name").value()
functions.storage.bucket(bucketName).object().onFinalize(async (object: ObjectMetadata) => {})
[REQUIRED] Steps to reproduce
.env file contains : APP_ENV="dev"
Build the functions.
Deploy the functions.
[REQUIRED] Expected behavior
Bucket name selected should be "prod-bucket-name", and function should be deployed successfully.
[REQUIRED] Actual behavior
Bucket name selected is "dev-bucket-name", and function is not deployed as the bucket belongs to different project and we get insufficient permissions error.
Were you able to successfully deploy your functions?
NO
Function is not deployed as the bucket belongs to different project and we get insufficient permissions error.
The text was updated successfully, but these errors were encountered: