I am integrating CI/CD for deploying my firebase functions.
firebase use PROJECTID --token FIREBASE_TOKEN
firebase deploy --token FIREBASE_TOKEN --non-interactive
Now whenever a function is deleted from index.js, it throws the following exception.
Error: The following functions are found in your project but do not
exist in your local source code: httpSeeding(us-central1) Aborting
because deletion cannot proceed in non-interactive mode. To fix,
manually delete the functions by running: firebase functions:delete
httpSeeding --region us-central1
Is there a way in the non-interactive mode where a deleted functions are removed from the console without running firebase functions:delete httpSeeding??
Run deploy with -f option, it should delete extra functions in non-interactive mode
firebase deploy --token FIREBASE_TOKEN -f
From the docs available by running firebase help deploy, we see following option:
-f, --force delete Cloud Functions missing from the current working directory without confirmation
Just run the same deploy command from your shell. It will automatically delete functions that are missing from your source.
Also you can delete functions directly from the Cloud console.
Related
when I running fireabse. i am running the following command :
"serve": "firebase use dev && firebase emulators:start --import=./emulator-data"
i have added data but I can not now save the data to the emulator
and I have got :
Error: Did not find any running emulators for project test-dev.
the command that i run is :
firebase emulators:export ./emulator-data
how can I fixed it ?
i verified the project is connected on gcloud and everything was working as it should
In order to troubleshoot this error you can follow the following steps as mentioned in Github_issue
ran sudo firebase emulators:export ./exported and got a new error
file not found!!
control c the running firebase process then ran it
again and got the same file not found error!!
command quit both
terminal windows
deleted the log files
ran the firebase emulator
again with "sudo firebase emulators:start --import ./data
--export-on-exit" (works)
opened another terminal window and "sudo firebase emulators:export ./exported" and it worked!!
Sometimes this issue can occur due to installations of firebase-tools path and npm and node paths are different. You may have a look at the link.
For additional information on emulators, you can follow the firebase documentation.
What I want to acheieve
So using Cloud Run, I wanted to achieve as below
Firebase Cloud Function(FCF) invoked
FCF makes a call to the other API service and fetch a certain value {bar:baz}
FCF makes a call to Cloud Run endpoint with the value as params
Cloud Run that was built and deployed with Docker Image of Firebase CLI gets triggered
in Cloud Run, it executes the commands firebase functions:config:set foo.bar=baz
Successfully updates FCF environment variables as foo.bar=baz
Issues
so previously asked here, Google Cloud Run - Run Shell Script in firebase project and with the solutions that were provided by #guillaume blaquiere, I finally got to the point where I run commands like firebase --version or firebase projects:list and they worked fine as the information is printed out on the browser.
However, when I run the commands like firebase use project test123 or firebase functions:config:set foo.bar=baz, Cloud Run throws the error exec error: exit status 1
Source Code
# Dockerfile
FROM node
RUN npm i -g firebase-tools
ADD my_script.sh /
COPY --from=msoap/shell2http /app/shell2http /shell2http
RUN chmod +x my_script.sh
ENTRYPOINT ["/shell2http","-export-all-vars"]
CMD ["/update","/my_script.sh"]
#my_script.sh
#!/bin/sh
firebase --token $TOKEN use foobarbaz-123
firebase functions:config:set foo.bar=baz
when build image with gcb
gcloud builds submit --tag gcr.io/foobarbaz-123/testbash
when deploy
gcloud run deploy --image gcr.io/foobarbaz-123/testbash --platform managed
or deploy with token that I get from firebase login:ci
gcloud run deploy --image gcr.io/foobarbaz-123/testbash --platform managed --set-env-vars=TOKEN=foobarbaz12345
where do I need to fix? Any advices or suggestions will be appreciated
Need to access some gcloud functions in a react project. Should I run gcloud init in the project root folder or within the firebase functions/ folder? Will it interfere with firebase deploy for the functions?
Following this: https://medium.com/#nedavniat/how-to-perform-and-schedule-firestore-backups-with-google-cloud-platform-and-nodejs-be44bbcd64ae
I already have some other firebase functions set up which I would deploy with firebase deploy --only functions. When I got to step 5 of the above tutorial, I got a gcloud command not found. I followed the instructions here: https://cloud.google.com/sdk/docs/#install_the_latest_cloud_tools_version_cloudsdk_current_version
and when it got to step 5 in that, I presume I should be doing it somewhere in the project folder to use that project's specific login? Without running it I get the following error when trying to use:
gcloud functions deploy backup --runtime nodejs8 --trigger-topic YOUR_TOPIC_NAME_HERE
ERROR: (gcloud.functions.deploy) Error parsing [name].
The [function] resource is not properly specified.
Failed to find attribute [project]. The attribute can be set in the following ways:
- provide the argument [--project] on the command line
- set the property [core/project]
The error message is clear. Add --project <project id> at the deploy command or perform a gcloud config set project <project id>.
If you use only firebase, firebase has automatically create a GCP project. Go to https://console.cloud.google.com to view your project name or ID. I think it's also possible to view this information in firebase console.
I am trying to hook up a simple static website to firebase hosting from Gitlab using their continuous integration tab. After downloading and installing firebase command line tools I am here:
stages:
- deploy
deploy-prod:
stage: deploy
only:
- master
script:
- firebase use <project-name> --token $FIREBASE_TOKEN
- firebase deploy --only hosting -m "Pipe $CI_PIPELINE_ID Build $CI_BUILD_ID" --token $FIREBASE_TOKEN
After that in firebase I deploy the site. However, gitlab then reports that the job is not deployed because
Error: firebase use must be run from a Firebase project directory.
Run firebase init to start a project directory in the current folder.
I dont understand the error, as I have in fact run firebase in the project director. Or is the error referring to the image thats in the yml file?
Either way, could someone please help me out? I've found a number of blog posts using CI in gitlab with firebase but I am stuck.
I got same issue and solved it by check folder structure
in my case:
/root/xx_project
firebase.json is in xx_project
so I need to cd xx_project
At the command line...
When I run firebase deploy, I get the following error:
Error: The entered credentials were incorrect.
When I run firebase deploy --debug, I get the following (more detailed) error (and log) shown when you click here. (firebase-debug.log)
When I run firebase deploy --project good-project-id, I get the expected deployment behavior.
When I rerun firebase deploy and firebase deploy --debug I get the same errors already described.
How do I make the proper changes to eliminate the errors when running firebase deploy?
Notes:
I am running Mac OS/X Yosemite v10.10.5
I just ran the NPM installation procedure (via Homebrew) described here.
Look at the contents of your .firebaserc file in your project directory. You likely have a "default" project alias specified. Run firebase list and see if that project id shows up there as well (note it should be the project id, not the instance/subdomain name).
If it doesn't match, that's likely your issue. Another thing you can try is deleting the .firebaserc file and then running firebase use --add to create a new project alias.