Google Drive Backup / Calendar Break on Restore

My Google Drive and Calendar were working fine before I backed up and restored the fresh V12 system. I have tried deleting the Google settings, reinstalling each setting, performing bench migrate and reboots but have been unsuccessful getting the Google backup and calendar integrations to work again. Has anyone experienced this type of error or have an idea how to fix it?

This is the error in the log:

Queue / Worker Job Created
failed
frappe.integrations.doctype.google_drive.google_drive.upload_system_backup_to_google_drive

Traceback (most recent call last):
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/worker.py”, line 793, in perform_job
rv = job.perform()
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/job.py”, line 599, in perform
self._result = self._execute()
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/job.py”, line 605, in _execute
return self.func(self.args, **self.kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py”, line 102, in execute_job
method(**kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/doctype/google_drive/google_drive.py”, line 188, in upload_system_backup_to_google_drive
validate_file_size()
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/offsite_backup_utils.py”, line 79, in validate_file_size
latest_file = get_latest_backup_file()
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/offsite_backup_utils.py”, line 52, in get_latest_backup_file
latest_file = get_latest('
.sql.gz’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/offsite_backup_utils.py”, line 50, in get_latest
return max(file_list, key=os.path.getctime)
ValueError: max() arg is an empty sequence

07-07-2020 21:19:27

Started Queued Failed Finished

Last refreshed 2020-07-07 21:20:58

I seemed to have solved the problem.

Here are some tips for other people trying to set up Google:

  • After you authorize the Google Calendar or Google Drive service, be sure to “Save” before you exit the ERPNext screen.
  • Set up the services using a user account, not the Administrator
  • When setting up your site and callback URI credentials in the Google developer console, be mindful of using http vs https if you are not using an encrypted site.
  • If you copy and past your Client ID into the ERPNext form, it may add extra spaces to the beginning of the ID. Make sure you delete the spaces or you will have heartburn authroizing.
2 Likes

I’ve been grappling with similar issues lately, and your pointers hit home. Especially the part about saving before exiting the ERPNext screen – that’s a detail I might’ve overlooked, but it makes total sense.

It’s funny how something seemingly minor like extra spaces in a client ID can throw a wrench into the whole authorization process, right? Your advice about using a user account instead of the admin account is spot on. It’s one of those things you learn through trial and error. And yeah, the http vs. https detail can be sneaky, especially if you’re not encrypting your site. Speaking of backups, have you ever tried loop backup for workspace? I’m fairly new to this forum and stumbled upon it while looking for reliable cloud backup solutions. It’s been a game-changer for me. It’s like having a safety net for all your Google Workspace data, which is a huge relief, especially with all these authorization quirks we’re navigating.