'Firebase Pubsub Schedule cant be deployed

I have a Firebase project running with around 20 functions and 10 pubsub topic listeners. I now wanted to add a pubusub schedule. But when adding this I get an error during deploy. Commenting it out it works direct.

To simplify testing I started a new Code project against the same project on firebase. I copied the pubsub schedule function from the guide however still get the same issue. So this is the only code I have:

const functions = require("firebase-functions");
exports.scheduledFunctionCrontab = functions.pubsub.schedule('5 11 * * *')
    .timeZone('America/New_York') // Users can choose timezone - default is America/Los_Angeles
    .onRun((context) => {
        console.log('This will be run every day at 11:05 AM Eastern!');
        return null;
    });

Im running the latest version of firebase tools 10.0.1. I have tried removing all functions and disabling pubsub and reenabling it with the samme issue.

Have tried other pubsub crontabs, different regions (I have mine in region europe-west).

This is the result I get when running:

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  functions: ensuring required API artifactregistry.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (49.48 KB) for uploading
i  functions: ensuring required API pubsub.googleapis.com is enabled...
i  functions: ensuring required API cloudscheduler.googleapis.com is enabled...
✔  functions: required API cloudscheduler.googleapis.com is enabled

Error: Failed to make request: Invalid response body while trying to fetch https://serviceusage.googleapis.com/v1/projects/XXXX/services/pubsub.googleapis.com: incorrect data check

Any idea to use this?



Solution 1:[1]

I too just received this error. I think from the message it is either one of two options

  1. You're internet connection dropped at the time that you were trying to update or
  2. There was an issue with Google's service at the time you pushed.

It's a network issue, I just think it's impossible to determine who is at fault. I would suggest if your internet is working perhaps wait a minute and then try it again.

I spent a few minutes trying to find this error since I had just made substantial changes to my cloud functions and thought I had messed something up. But no, I ran the code a second time without doing anything and it deployed just fine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 marcus.salinas