I have a GCP Cloud Function which is triggered via a Pub/sub topic. The function just backs up Datastore data to Cloud storage. The function works fine but I get a
Function execution took 933 ms. Finished with status: response error
and I don't understand why? As far as I understand I follow what is in the GCP Docs.
My code looks like this:
/* receives pub/sub message which is triggered every 24h.
*/
exports.subscribe = async (message, context) => {
console.log('CHRON HANDLER STARTED');
await this.backupDB();
return Promise.resolve();
}
const bucket = 'gs://XXX_db_backups';
exports.backupDB = async () => {
try {
const databaseName = client.databasePath('XXX', '(default)');
await client.exportDocuments({
name: databaseName,
outputUriPrefix: bucket,
collectionIds: ['backuptest', ],
});
} catch (error) {
console.log(error);
}
console.log('DB BACKUP SUCCESS');
};
EDIT 1
The complete error message is:
2022-04-09T10:30:15.076043374Z test-chron-handler yuthy3qj84sr Function execution took 933 ms. Finished with status: response error
Actually it is not even flagged as an error in the Cloud Functions log, it is just a regular status message that logs that the function ended. But as you can see the finishing status is indeed an error.