firebase functions still dont work after i verified my billing stuff - firebase

when I try deploying my app this outputs:
Error: Your project quiz-byte must be on the Blaze (pay-as-you-go) plan to complete this command. Required API cloudbuild.googleapis.com can't be enabled until the upgrade is complete. To upgrade, visit the following URL:
I did verify my billing options, but they keep asking me to pay for their paid plan.
Am I supposed to wait some time or something?

Related

Get rid of annoying logs by Firebase function "this may be a production service" & "External network resource requested"

When running a Firebase function, my logs are very noisy mostly because of those 2 messages
Be careful, this may be a production service.
⚠ External network resource requested!
I know I am running a production service, and yes I am requesting an external ressource 😅 can I disable them?
Thanks
Normally using --quiet would silence this message, however because there are so many emulators, the Firebase team couldn't reach a consensus on whether to allow this to be silenced when used with firebase emulators:start (see firebase-tools Issue #2859).
The official stance on this is to set the logs filter to only show "user" logs using the Emulator Suite UI's Logs Viewer and let the regular log feed log everything.

There was an error granting Firebase Service Agent access to your secret

I am facing an error while installing an Algolia extension into my firebase project.
Error-
When I click on the "Create secret" button, the error below is visible
Only admin can add Key. Check your project permission
When installing the extension it will ask you to enable the secrets API, what this does is enables the Secrets Manager API from google cloud (what firebase is built on top of). You can manually check this is enabled with the below URL, and if its not - enable it.
https://console.cloud.google.com/apis/api/secretmanager.googleapis.com/overview?project=YOUR_PROJECT_ID
As with all google cloud API's, when you enable them it takes a few minutes for the changes to propagate. Try again in ten minutes, and you will find your error is resolved, you're able to create the secret, and you can install the extension.

What service account roles to deploy a scheduled Cloud Function?

To deploy my Firebase project, I have setup a service account with the roles:
Cloud Functions Admin
Firebase Admin
Service Account User
It works fine with Hosting and Cloud Functions triggered by Firestore or HTTPS, but it fails with a function on schedule.
What additional role do I need?
Edit: the only related ouput messages are:
i functions: updating Node.js 14 function schedule-statistics(europe-west3)...
...
✔ functions[schedule-statistics(europe-west3)]: Successful update operation.
...
Functions deploy had errors with the following functions:
schedule-statistics(europe-west3)
Edit: additional test: when deploying using my logged-in CLI on my machine, I see this additional message, which is missing when deploying with the service account:
✔ functions[schedule-statistics(europe-west3)]: Successful upsert schedule operation.
Edit: by adding logs as suggested by #Dharmaraj, I can see the missing permissions:
The principal (user or service account) lacks IAM permission \"cloudscheduler.jobs.get\"
...
The principal (user or service account) lacks IAM permission \"cloudscheduler.jobs.update\"
So when adding the "Cloud Scheduler Admin", it works!
I was misled because I already set this role to the service account but within another project, and it does not propagate! Lesson learned at the expense of a nice afternoon.
The answer is: add role "Cloud Scheduler Admin".
The gotcha is: roles set to a service account in one project do not propagate to the same service account in other project.
The nice lesson is: add --debug to see additional logs, including missing permissions, thanks #Dharmaraj

With the free account of Firebase is it possible to backup firestore? How?

I have Spark plan (free) and I would like to backup the Firestore Data. I followed this Tutorial but it returns this error:
ERROR: (gcloud.firestore.export) PERMISSION_DENIED: This API method requires billing to be enabled. Please enable billing on project by visiting https://console.developers.google.com/billing/ then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry.
Error: Process completed with exit code 1.
Is there a way to to backup it WITHOUT UPGRADING TO BLAZE? If yes, how?
The error message is pretty explicit:
This API method requires billing to be enabled.
The documentation on exporting data also has this note:
Firebase projects must be on the Blaze plan to use the managed export and import feature. Enabling billing for the Google Cloud automatically upgrades your Firebase project to the Blaze plan.
So it looks like your project will need to be on the Blaze plan to use scheduled exports.

Firebase - lacks IAM permission "cloudscheduler.jobs.update"

After implementing firebase function as below code, deploy failed.
generateDailyStat: functions.pubsub.schedule('every day 00:00').timeZone('Asia/Seoul').onRun(generateDailyStat),
Error messages are as below.
i functions: creating Node.js 8 function generateDailyStat(us-central1)...
i scheduler: ensuring necessary APIs are enabled...
i pubsub: ensuring necessary APIs are enabled...
✔ scheduler: all necessary APIs are enabled
✔ pubsub: all necessary APIs are enabled
Error: HTTP Error: 403, The principal (user or service account) lacks IAM permission "cloudscheduler.jobs.update" for the resource "projects/MY_PROJECT/locations/asia-northeast2/jobs/firebase-schedule-generateDailyStat-us-central1" (or the resource may not exist).
My account is 'owner' role, and I give owner role of cloudscheduler to firebase service account. But still failed.
What did I miss?
Searching about it, it seems that this error might be related to the fact that the permission cloudscheduler.jobs.update - as per the documentation Support level for permissions in custom roles - it's not supported for use yet, it's still in the Testing status, which means that some exceptions and errors are expected.
In another post on the community, a user informed that removing all the permissions and adding again, fixed the case "magically", so it might be an option for you to give a try. You can find more information on this solved case here:
The principal (user or service account) lacks IAM permission “cloudtasks.tasks.create” for the resource.
Let me know if the information clarified and helped you!

Resources