• Resolved andypresh

    (@andypresh)


    I had an issue where sometimes a form submits correctly (i.e. email sent, submission logged in Flamingo etc.) but wasn’t added to the spreadsheet, and no error was reported in the debug log.

    I had a look at the plugin source code and found that you need to comment out the following lines of /wp-content/plugins/cf7-google-sheets-connector/lib/google-sheets.php

    Comment out lines:
    125
    // try {
    184-187
    // } catch ( Exception $e ) {
    // return null;
    // exit();
    // }`

    These lines cause the plugin to ignore any error (Exception) which occurs when adding a row – it simply ignores the error when it is caught, instead of logging it. I’m not sure why the developer did this, it seems a bit silly so I figure it was an oversight.

    By commenting these lines out, the Exception bubbles up to \plugins\cf7-google-sheets-connector\includes\class-gs-service.php where it is caught on line 256 and added to the debug log as a result.

    After doing this, I could see the error in the log – in my case, it was:
    Quota exceeded for quota metric ‘Read requests’ and limit ‘Read requests per minute’ of service ‘sheets.googleapis.com’ for consumer ‘project_number:xxxxxxx’.
    So at least I can use the data in the error log to manually back-fill these. Not ideal, but better than nothing!

    Please fix this in future versions so I don’t have to repeat this fix whenever the plugin is updated – thanks 🙂

    Presh

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WesternDeal

    (@westerndeal)

    Hello Presh @andypresh
    Thanks for getting in touch,

    I have checked the code, there is no need to comment whole,
    It helps to send entries to the google sheet
    If you would comment on the whole code then the entry will not submit in Google Sheet,
    Therefore keep the code as it is.

    For exception, regarding error handling, we are implementing to show the errors in debug.log file, so that for any reason if entry did not pass to sheet it shows error.

    So in conclusion,
    You have commented on the wrong lines, no need to do that, as the entry will not show in the sheet.

    And then test the form, it will work,
    Due to Quota being exceeded entry was not submitted, therefore it will appear in the next minute. You can refer to the link for limit understanding!

    Hope it clears!

    Thanks
    Abdullah

    Thread Starter andypresh

    (@andypresh)

    Thanks for the reply Abdullah. 🙂

    I think you may be misunderstanding which lines of code I have commented out.

    You say “If you would comment on the whole code then the entry will not submit in Google Sheet” – I am only commenting out the try/catch block (lines 125 & 184-187), not any of the code which handles the submission. I would not comment the whole code! That would be silly 🙂 but the catch block with return null; just ignores the error instead of logging it… so by removing the try/catch block, the error gets caught further up the chain and logged correctly.

    I have tested my version and the form submits correctly, and the entry either appears on the Google Sheet as usual, or the error returned by Google Sheets is logged.

    I’m also not sure what you mean by “Due to Quota being exceeded entry was not submitted, therefore it will appear in the next minute.” – I’ve done a lot of testing and I have never seen failed entries appear later. Google don’t say this will happen, instead they recommend an Exponential Backoff strategy, but I’m not worried about this. I suppose it is something you could add to Pro version, if you haven’t already. But it’s a rare error, so for now I can add them to the spreadsheet manually. 🙂

    Best wishes
    Presh

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to fix the error log’ is closed to new replies.