TKizir
TKizir

Reputation: 27

Firebase, Cloud Function -- Error: 9 FAILED_PRECONDITION: The 'read_time' cannot be more than 270 seconds in the past

My collection has approx. 20.000 documents, when I try to update each of them by below code; I get this error: Error: 9 FAILED_PRECONDITION: The 'read_time' cannot be more than 270 seconds in the past. The requested value was '2021-05-11T19:09:49.064209Z', but the minimum allowed value was '2021-05-11T19:10:23.865748Z'. I tried to solve this issue by using batch but not worked. Any recommendation?

 exports.scheduledFunctionFilms = functions.runWith(runtimeOpts).region('europe-west3').pubsub.schedule('0 05 * * 0').timeZone('Europe/Istanbul').onRun((context) => {

db.collection('Films').get().then(querySnapshot => {


    if (querySnapshot.empty) {
        console.log("null film")
        return null;
    } else {
        const promises = []
        console.log("started film")
        querySnapshot.forEach(doc => {
            promises.push(doc.ref.update({sectionPoint:0}));
        });
        console.log("finished film")
        return Promise.all(promises);
    }
}).catch(error => {

    console.log('uncaught error film: ', error);

});

Upvotes: 1

Views: 734

Answers (1)

Lenin J
Lenin J

Reputation: 15

I guess, there is an issue with the Google cloud Firestore on 11th May (https://status.cloud.google.com/incidents/VVJnin9xh36NeBQ7Ut3c). I got the same on 20th May.

Upvotes: 1

Related Questions