Cloud Function stuck in an infinite loop

Viewed 4164
exports.addNewValue = functions.database.ref('/path')
.onWrite(event => {    
    event.data.adminRef.update({"timeSnapshot":Date.now()})})

It appears that Date.now() causes an infinite loop in the function because the following does not:

exports.addNewValue = functions.database.ref('/path')
.onWrite(event => {    
    event.data.adminRef.update({"timeSnapshot":"newString"})})

How do I fix this?

3 Answers
Related