Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Failed to upload Firebase function for pub/sub listener via firebase deploy

Hello, I'm currently trying to deploy a test function for listening to a topic from pub/sub.

Here is the step I have done:

  • Create a firebase functions project via firebase init
  • Enable Cloud Pub/Sub API and create a topic
  • Enable Cloud Build API (not create a service yet)
  • Add sample to listen to published message

 

import { logger, pubsub } from "firebase-functions/v2";

exports.helloWorld = pubsub.onMessagePublished(
  "subscription-listener",
  (event) => {
    logger.log("Event data: ", event.data.message);
  }
);

 

When I tried to run `firebase deploy`, it gives me error below:

 

HTTP Error: 400, Could not create Cloud Run service helloworld. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed 10

 

Are there any other step that is required to be done to be able to deploy the code?

0 2 1,079
2 REPLIES 2

Hi @danhdao,

Welcome to the Google Cloud Community!

Try the following troubleshooting options:

  1. Add maxInstances: (number less than 10) to frameworksBackend section of your firebase.json file. Check this Stack Overflow Post as you might have the same case.
  2. Try specifying the max instances with --max-instances to a value less than 10. Check out this reference and documentation.
  3. Try running firebase --debug deploy to print a verbose debug output and keep a debug log file.
  4. You can also get in touch with Google Cloud Support if the above options don't work.

Let me know if it helped, thanks!

Pul
Bronze 1
Bronze 1
This worked for me, When I too got this error:- had to specify maxInstances:10
exports.api = functionsV2.onRequest({cors: true, minInstances: 1, maxInstances: 10}, api);​