Snapshot not saving to Google Drive

So I am going merrily along thinking my backups are being saved to Google Drive. Now, having a problem setting up another site to use your Managed Backup I go back and check the 2 sites I supposedly have set up to save to Google Drive, and lo and behold, there are no backups on my Drive since June! This is on 2 sites on different servers. When I go into the Destination in Snapshot it says it is complete (and backups were saved up until June), but there is the following error at the bottom: Fatal error: Call to a member function log_message() on null in /home/site/public_html/wp-content/plugins/snapshot/lib/Snapshot/Model/Destination/google-drive/index.php on line 259

I have authorized support access on both sites if it is helpful for you to log in.

  • Dimitris

    Hey there joan_donogh,

    hope you're doing good today!

    I can see that there were another similar issue some time ago but it was due to faulty Google credentials.

    Please have a look in Jose's reply here
    https://premium.wpmudev.org/forums/topic/snapshot-is-returning-an-error-in-destinations-settings#post-805782

    Could you please double check your google connection and especially the followings:
    - Your project has Drive API and Drive SDK enabled.
    - The Application Type is set to Web application.
    - There are no spaces at the beginning or end in your client ID and Client Secret.
    - Your site's domain is in the Authorized Javascript Origin field.
    If possible, please create a new client ID checking all the points above.

    If this still persists, please grant us support access to your website via "WPMUDEV Dashboard" plugin as described here https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/ and please allow us to use our own Google Drive connection credentials for testing.

    I look forward for your results on this!
    Take care,
    Dimitris

  • joan_donogh

    I have no idea how to check the Google connection. I looked and I can't see any of those things. I tried to create a new project, but there is no such thing as Drive SDK. (This is why I was trying to enable backup to your server, because Google is so difficult to figure out, but that does not work either) As I said, it used to work and then it just stopped. As I also said, I enabled support access already.

  • Adam Czajczyk

    Hello joan-donogh!

    Thanks for granting an access. I checked the site and I can see there are two Google Drive destinations there out of which one is not fully configured and the other one is the one that seems to be used previously.

    I checked it and reviewed snapshot logs for it and it seems that there's indeed authentication error. The code of an error usually means that the Client ID or Client Secret code is wrong (like API was disabled or an API usage quota was reached). I'm not able to check it though because I don't have an access to your Google Developer console.

    If you wish me to check it, you could provide me with credentials letting me access your Google Developer console and I'd see what I can do. You can safely leave any credentials information for support staff in a text box in support access section of "WPMU DEV -> Support" page in your dashboard (that message doesn't get posted anywhere and it stays within your site).

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Joan!

    Thanks for this but I must admit that I, so to say, messed up a bit. I'm very, very sorry for this. I completely forgot (I usually use my own accounts from very specific locations and devices) that Google will most likely ask for some confirmation upon any "unusual" access attempt. And of course that happened so I can't access the account and I wouldn't be surprised if it asked you to confirm again.

    I sincerely apologize for this, I guess I just fall a victim of getting used to be constantly logged in and working from the same place everyday

    Here's a different way though that we may do this. If you go to your Google Developers console and just create a new project (no need to go any further) you can then click on a menu icon (three horizontal bars on the left of "Google APIs" logo) and select "IAM & Admin" option.

    You should end up on "IAM" screen (if not, click "IAM" in menu on the left) seeing "Permissions for project "NameOfYourNewProject". On this page click on a blue "Add" icon on top (blue person with "+") and then in "Members" text form type in "adamwpmudev@gmail.com" and select "Project -> Editor" role for the drop-down menu and click "Add".

    This would give me access to this project via my own account and my own Google Developers console so I would then should be able to set it up for you.

    Best regards,
    Adam

  • joan_donogh

    Hi Adam,
    Yes I got a security alert, but I knew it was you! I forgot that about Google too - I guess it is good that they keep a tight control, but sometimes it does not work in our favour!

    I added you as an editor on the 2 existing projects if that would work - I would like to know why they did work but then stopped in June.

    Also the on site backups seem to be working sporadically. Aquatechnik is set to run daily backups, but in the (on server) archives there is October 4, 7, 8, 10, 16, 20 and 21 - I think it is set to keep 7 but wouldn't it keep the most recent 7?

    And NYC is set for weekly backups - and there is a backup for Oct 18 - but the previous one is Sept 20th. I also noticed in my Google drive that when things went wrong - June 14th there are 2 backups saved for that day - one is 71MB and the other is 148MB - while the backup on the server is 36 MB. It was after this that the backups never saved to Google drive again. Aquatechnik stopped working at the same time - although the saved backups don't seem odd like NYC.

    If this plugin won't work reliably I need to find one that will.

  • Adam Czajczyk

    Hello Joan!

    I got access to your Google Developers Console, thank you. For now proceeded with following steps:

    - created a new Destination ("NYC Backup (WPMU)") on "Snapshot -> Destinations" page
    - in Google Console I double-checked all the settings for the project, including DriveAPI (it's enabled)
    - updated the "Authorized redirect URIs" setting on "Credentials" page in Google Console for the "NYC Backup" OAuth 2.0 client to match this new "Destination"
    - setup Client ID and Client Secret for the "Destination".

    So far, it looks good. There's one more step that I cannot complete though because of Google Security (no access to your account): please go to the "Snapshot -> Destinations -> NYC Backup (WPMU)" page and click on "Authorize" button at the bottom

    - make sure that you are already logged in to the proper Google Account before doing this
    - then copy the authorization code given and use it in the Authorization code field that shows ukp on destination edit screen

    If this saves with no errors (it should now), edit your snapshot(s) to select this new destination and see how this goes.

    Keep me updated please.

    Best regards,
    Adam

  • joan_donogh

    Hi Adam,
    I clicked on the Authorize button - I was logged in to my Google account at the time - but no authorization code or authorization field showed up. It just said you must save one last time to retain the authorization, which I did and it says authorization complete. At any rate it does not have a fatal error. I changed the destination for the Snapshot to this new one and set it to run now - it seems to be working. It is sending all the files that were previously backed up on the server to the Google drive (which I didn't know it was going to do - I guess I should have set up a new snapshot!)

    Joan

  • Adam Czajczyk

    Hello Joan!

    It just said you must save one last time to retain the authorization, which I did and it says authorization complete.

    Ah, yes, that's my mistake. Google changed that so they no longer give you code and ask to put it into the plugin - this happens automatically now. I completely forgot about this, I'm sorry. You did good though so it's fine.

    That being said, it seems that it's working for you now, do I understand correctly?

    As for snapshot. You can of course create another snapshot and even use the same destination for it. You can disable the current one on snapshot edit screen by changing "Backup Interval" to "Save only" and saving settings.

    Once you are sure that it's working fine, please also feel free to remove me from your Google Developers Console (that won't break anything, just remove me an access).

    Best regards,
    Adam

  • joan_donogh

    Hi Adam, thank you for all your help. Yes that backup seems to be running again. I have managed to create a new Google Drive destination for the other site that had suddenly stopped working and also got it to run successfully! As I mentioned that one was supposed to run daily - but there were huge gaps in the backup files saved to the server. In looking at the php error log, it seems there are frequent problems with your API:

    [01-Oct-2016 19:57:25 UTC] [WPMUDEV API Error] 4.1.2 | cURL error 6: name lookup timed out ((unknown URL) [500])
    [01-Oct-2016 19:57:36 UTC] [WPMUDEV API Error] 4.1.2 | cURL error 6: name lookup timed out ((unknown URL) [500])
    [05-Oct-2016 07:39:00 UTC] [WPMUDEV API Error] 4.1.2 | cURL error 28: Operation timed out after 15001 milliseconds with 0 bytes received ((unknown URL) [500])
    [13-Oct-2016 19:16:07 UTC] [WPMUDEV API Error] 4.2 | cURL error 28: Operation timed out after 15001 milliseconds with 0 bytes received ((unknown URL) [500])
    [16-Oct-2016 19:27:26 UTC] [WPMUDEV API Error] 4.2 | cURL error 6: name lookup timed out ((unknown URL) [500])
    [16-Oct-2016 19:46:50 UTC] [WPMUDEV API Error] 4.2 | cURL error 6: name lookup timed out ((unknown URL) [500])
    [18-Oct-2016 19:24:32 UTC] [WPMUDEV API Error] 4.2 | cURL error 28: Operation timed out after 15001 milliseconds with 0 bytes received ((unknown URL) [500])
    [18-Oct-2016 20:00:55 UTC] [WPMUDEV API Error] 4.2 | cURL error 28: Operation timed out after 15001 milliseconds with 0 bytes received ((unknown URL) [500])

    Personally, I would appreciate your plugin sending an email notification if it is unable to complete the backup. I know if you go into the Snapshot page on the site you will see if there is success or failure, but I don't expect to have to be checking up on it all the time. If it won't run properly, I need to find a backup solution that will. I am just about ready to give up on WPMUDEV - nothing seems to work as advertised.

  • Adam Czajczyk

    Hello Joan!

    As I mentioned that one was supposed to run daily - but there were huge gaps in the backup files saved to the server. In looking at the php error log, it seems there are frequent problems with your API:

    The API/connectivity errors does happen sometimes, I admit. I'm not aware though of any recent serious issues except the problem that's been caused by this huge DDOS attack on Oct 21st that "paralyzed" half of the world's internet. The logs however are from before that day and they are from before our recent actions here. They don't also point to the Snapshot. The WPMU DEV API is used with snapshot but for Managed Backups only while we were working with regular "snapshots" here which doesn't need access to API to work. This doesn't seem related then.

    As for "missing backups".

    If this works now, it doesn't work "backwards". If there were any "not sent" backup archives, they could be pushed to the destination but whether it's fully working or not we can only find out buy keeping a close eye on what's happening since the first successful run recently (I think that'd be related to this post from Oct 26th).

    I took another look at the site and checked the log of the only snapshot (Snapshot -> Snapshots page) that currently exists and is enabled. It confirms that the recent backup (Oct 27th) has been created and successfully delivered to the GDrive destination.

    The snapshot itself is set to "weekly" schedule - each Thursday at 3.43am. You mentioned that it's supposed to run "daily" but the next scheduled run, due to the current settings, would be in a week. That would indeed a "gap" as well as all the time from before it worked would be a "gap".

    I think then that you may want to edit that snapshot and set it to "daily" schedule, just like you mentioned in your post, and then watch it for a few days to see how it performs. I believe it will work well but of course in case there were still issues I'm ready to continue assisting you.

    Kind regards,
    Adam

  • joan_donogh

    I deleted the old snapshot - I guess that also deleted the backup files that were on the server! It was set to run daily - but it was not happening. Nothing was saving to Google Drive at all - but "sometimes" the backup would run and save locally. As I had mentioned above, there were backups for October 4, 7, 8, 10, 16, 20 and 21. The only errors in the php error log are those above related to the WMPUDEV API - and no, they don't correspond exactly to the non-running days of the daily backup.

    I thought maybe the file size might have been an issue - the full backup files are 45MB, and I decided I don't really need a daily backup of all the files - so I created 2 snapshots - a daily snapshot of just the database (which I ran manually this morning) and a weekly backup of the full site which is scheduled to run at 3:43AM on Thursday.

  • Adam Czajczyk

    Hello Joan!

    Thank you for your response, I understand that. All I'm suggesting is to leave the snapshot running for just a few days (or - if it's supposed to run weekly - weeks) and see what's happening: if it gets created as it should and if archives are properly delivered. What was happening before is surely an issue but that's no other way to check if its now fixed or not and if not, to see what else is interfering here. I'd really love to make it work flawlessly for you and I'd appreciate if you could let the snapshot work for a while and let me know about its performance on your site.

    Kind regards,
    Adam

  • joan_donogh

    Hi Adam, I hope you are doing well. The snapshot backups have been working well, however suddenly they have stopped running on one of my sites. The backup was scheduled to run on Feb. 23rd. But it just did not run. It still says the next backup is scheduled to run on Feb 23rd. I ran a manual backup on Feb 24th, and it ran successfully, but will not save to google drive - it still shows as Pending. I have authorized support login so you can see what is happening.

    Thank you,
    Joan

  • Dimitris

    Hey there joan_donogh,

    hope you're doing good today!

    I just reviewed the log files of both of your snapshots and noticed that original snapshot never got triggered on February 23rd while the new snapshot never started uploading to your Google Drive account.

    Could you please try to run the original snapshot to see what's the result?
    I'm referring to the one that should have been triggered on February 23rd.
    Simply hover over it when you're on the "All Snapshots" admin page here
    https://yourdomain.com/wp-admin/network/admin.php?page=snapshots_edit_panel
    and click on the "run now" link.

    Let us know how that goes!
    Take care,
    Dimitris

    PS. If you could also install a little plugin that will help us inspect your cron jobs, it would be awesome! https://wordpress.org/plugins/wp-crontrol/
    Please keep in mind that these automatic backups are being triggered via cron jobs and these cron jobs require some actual traffic to the website in order to get triggered. I can see in your analytics admin area that you've got some traffic though, and this shouldn't be the case here.

  • Adam Czajczyk

    Hello Joan!

    I accessed and checked your site and there seem to be an issue with WP Cron. It's a built-in mechanism that lets WordPress and its plugins schedule various periodic tasks and it seems to be failing.

    The WP Snapshot plugin says "next run" on Feb 18th while it's already March 1st today. The WP Crontrol plugin that you installed shows that tasks are schedules but it also says that there was a problem and that server response to WP Cron is "Unexpected HTTP response code: 403".

    That would mean that WP Cron is not running scheduled tasks, hence - backups are not created and also some other aspects of the site ("under the hood") may not work properly.

    The question then is "why it stopped working" suddenly (most likely around Feb 18th). That moves us sort of back to the essential troubleshooting which would be a full theme/plugin conflict test to see if a theme or some other plugin is not breaking it.

    It may however be a bit troublesome to test that due to the nature of Cron tasks (the fact they are usually running in background) so while conducting the test, I would focus on WP Crontrol plugin and what does it say.

    Please take a look at "Tools -> Cron Events" page in the dashboard of your main site and you should see the error there (on top of the page). Then, please follow the steps from flowchart in this article while keeping WP Crontrol plugin enabled all the time and checking whether this error goes away or not (please reload the "Tools -> Cron Events" page each time):

    https://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    This procedure should show us if (and if yes, which one) any other plugin is conflicting or will exclude the conflict. Then, depending on the result, we'll continue troubleshooting that.

    Let me know about test result please.

    Kind regards,
    Adam

  • joan_donogh

    Hi Adam, thank you for your help! Your comments made me remember that I had a problem on my website and I looked up the hosting support ticket and it was on Feb 18th. The problem was that I had blocked an IP in iThemes security that was submitting a ton of spam comments. After that I had a 403 error and they said it was due to a malfunctioning module on the server which they fixed. Well it turns out that the IP I blocked was the server IP (I guess the malfunctioning part was that the server IP was showing instead of the actual spamming IP). I unblocked the IP and all is well once again!