'Scheduled function "Failed to update function in region europe-west1"

I'm trying to deploy a scheduled function but something is not right (I may be doing something wrong).

[error] Error: There was an error deploying functions:
[error] - Error Failed to update function scheduledFunction in region europe-west1

The function in detail:

const functions = require("firebase-functions");
const admin = require("firebase-admin");
const { collection, getDocs } = require("firebase/firestore");
admin.initializeApp();
const db = admin.firestore();

exports.scheduledFunction = functions
   .region('europe-west1') // because my GCP is eur3 (europe-west) in my firebase config
   .pubsub
   .schedule("every 5 minutes")
   .onRun((context) => {
      const coinsRef = db.collection("coins")
      console.log(coinsRef)
      return null
});

For now, I want to retrieve all of my documents and display it in a console.log.

If I remove the region I get the same error but for us-central. If I specify a time zone rather than a region, the 1st error is displayed.

By removing my coinsRef constant and the region (thus having a totally EMPTY function) it works.

What am I doing wrong?



Sources

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

Source: Stack Overflow

Solution Source