Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes a GCP Cloud Functions response error?

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.

like image 299
jola Avatar asked Jan 25 '26 13:01

jola


1 Answers

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:

GCP logs show function "Function execution took xxx ms. Finished with status: response error" whenever my header status code is not 200

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

like image 161
Robert Sandberg Avatar answered Jan 28 '26 05:01

Robert Sandberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!