Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

400 Billing account for project is not found. Billing must be enabled for activation of service(s)

I am create API with firebase via this tutorial here.

On I run:

firebase deploy

I get this error on the command line:

HTTP Error: 400, Billing account for project '381106441303' is not found. Billing must be enabled for activation of service(s) 'cloudbuild.googleapis.com,containerregistry.googleapis.com' to proceed.

Please show me how to fix this problem!

like image 865
Hao Avatar asked Sep 17 '20 06:09

Hao


People also ask

How do I link my project to my billing account?

In the Google Cloud console, go to the Account management page for the Cloud Billing account. At the prompt, choose the Cloud Billing account you want to view. On the Account management page, linked projects are listed under Projects linked to this billing account.

Who can change the billing account linked to a project in GCP?

To move your project to a different billing account, you must be a billing administrator and the project owner.

How do I check if Billing is enabled on a project?

If billing is enabled on the project, and if you have more than one Cloud Billing account, a pop-up window will display, with text similar to: To view the Billing Overview page for the Cloud Billing account that is linked to the project, select Go to linked billing account.

How do I view the cloud billing account linked to projects?

To view the Cloud Billing account linked to a project, do the following. Sign in to the Google Cloud Console. In the project drop down ( My Project arrow_drop_down ) at the top of the Google Cloud Console page, select your project. Open the console Navigation menu ( menu ), and then select Billing.

How do I enable billing on a Google Cloud project?

In the project drop down ( My Project arrow_drop_down ) at the top of the Google Cloud Console page, select your project. Open the console Navigation menu ( menu ), and then select Billing. If billing is not enabled on the project, a pop-up window opens, with text similar to: To enable billing on the project , select Link a billing account.

Do I need an active billing account for Cloud Functions?

The tutorial you're following is very old. Cloud Functions now requires an active billing account. You will need to add one, even if you don't expect to exceed the free allowance. Consider contacting the author of that article to tell them that they should update their article to be more accurate.


7 Answers

If you just want to finish a tutorial, just change Node version from 10 to 8 in package.json

"engines": {
  "node": "8"
}

This will now work, but eventually after February 15, 2021 deployment of Node.js 8 functions will no longer be allowed. So, if you want to use cloud functions after this date you must be on Blaze pay-as-you-go billing plan.

like image 85
Zivojin Milutinovic Avatar answered Oct 28 '22 09:10

Zivojin Milutinovic


If you just want to test or follow the tutorial, see this answer.

If you want to use at the real projects, follow these steps:

  1. Enable Billing for your projects
  2. Enable Cloud Build API
  3. Enable Container Registry API

From Firebase FAQ:

From updates on August 17, 2020, Cloud Functions for Firebase will rely on some additional paid Google services, so You have to add billing, enable Container Registry API and Cloud Storage API to use it.

See more: Cloud Functions pricing

Edit: Following these steps automatically upgrades your Project plan to Blaze-Pay as you go. - Thanks to @Abhimanyu

like image 21
Albert Khang Avatar answered Oct 28 '22 10:10

Albert Khang


The tutorial you're following is very old. Cloud Functions now requires an active billing account. You will need to add one, even if you don't expect to exceed the free allowance.

See also:

  • Is Function Cloud in Firebase Free or Not (Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan)

Consider contacting the author of that article to tell them that they should update their article to be more accurate.

like image 10
Doug Stevenson Avatar answered Oct 28 '22 10:10

Doug Stevenson


It works fine for me you don't have to pay I'm using firebase free tier

1st Downgrade node version from 10 to 8 on package.json

"engines": {
"node": "8"
  }
  1. firebase deploy

  2. you'll get + Deploy complete! message above that you'll see

    + functions[helloWorld(us-central1)]: Successful update operation.

  3. this us-central is my project hosted region in your case may be differ

    prefix to this region [helloWorld is my exported function name your case it may differ get this information from your terminal by firebase deploy command

  4. After that your hosted project link will be

https://yourregion-firebaseprojectname.cloudfunctions.net/yourexportedfunctionname 

(exported function name) which is helloWorld

like image 8
Deepak kumar debug Avatar answered Oct 28 '22 10:10

Deepak kumar debug


You can lower the node version from 10 to 8, but you should upgrade your plan to 'Blaze' as it has the whole free plan, It will only charge you if you pass the free plan

like image 4
Carlos Javier Bazan Human Avatar answered Oct 28 '22 09:10

Carlos Javier Bazan Human


You can try this :

firebase deploy --only hosting

Full docs

like image 3
Ruslana Logosha Avatar answered Oct 28 '22 09:10

Ruslana Logosha


This is a example of scheduler , but this will not work in free account . Billing must be enabled for activation of service(s) 'cloudscheduler.googleapis.com' to proceed.

import * as functions from 'firebase-functions';
import {db, notificationSentEvent, deviceData} from './init';

export const dailyDelete = functions.pubsub.schedule( '10 1 * * *' ).onRun(context => {
    console.log('At 01:10');
})
like image 1
Md omer arafat Avatar answered Oct 28 '22 09:10

Md omer arafat