Reputation: 1115
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.
Upvotes: 3
Views: 1670
Reputation: 8635
It seems like this is a current known issue when a function returns anything but a 200. Even 201 and 204 give response error in the logs. It seems to only affect the logs and not the actual response. I've verified this in my setup.
In this SO question:
The following comment was written:
The product team is aware of this issue and they have updated today that the change is reverted back, you can expect the previous behavior to be resumed shortly. Let me know if you face any errors after a day or two. – Priyashree Bhadra Apr 19 at 11:02
Upvotes: 4
Reputation: 1685
This issue happens when the response size from the functions exceeds 10MB 1. I think you hit the max response size which is 10 MB for functions.
For more information please go through these stackoverflow links 2 & 3.
Upvotes: 0