Google Breaks Things (Again)

Google Drive is gradually becoming more and more of a mess. Unfortunately, there’s absolutely no viable alternative to Google Docs still, so I need to use it. And, of course, I need to backup it.

For the last couple of years, I’ve been using rclone in a cronjob (and, later, a systemd timer) to sync my Google Drive contents to a local directory, and my backup system would take it from there. I set up Docs to be downloaded as OpenDocument files (Documents would be .odt, Sheets would be .ods, etc.), and the system worked perfectly. Up until this year.

All of a sudden, rclone started throwing errors when attempting to download my Docs. I only noticed it recently by occasion: I happened to have my backup server’s system log open to debug another piece of software when rclone fired up. A little investigation showed that all the Docs that have been created or modified after June 13, 2021 would refuse to download:

Error
Failed to copy: failed to open source object: open file failed: googleapi: Error 403: Only files with binary content can be downloaded. Use Export with Docs Editors files., fileNotDownloadable

I started poking at Google Drive API and quickly found out that I could still download any file in OpenDocument format as long as I had the right permissions. And it turned out that I gave my rclone the drive.readonly scope instead of drive back when I set it up a couple of years ago. It used to be enough — after all, I was only interested in one-way synchronization. Suddenly, it doesn’t suffice any longer, and now you need a full drive scope for things to work.

Once I figured out what was wrong, fixing the scope took less than a minute. Would I have been able to figure it all out had I not had some experience in using Docs API? I seriously doubt it, especially with such a “helpful” error message.

What the hell, Google?!


On a side note: I definitely need to develop a habit of making my systemd units send me an email on failure. It’s not too hard anyway, I already have a unit file:

[Unit]
Description=OnFailure email for %i

[Service]
Type=oneshot
ExecStart=/home/evgeny/scripts/failure-email.sh %i

And the failure-email.sh script is a one-liner, too:

#!/bin/bash

mail -s "$1 failed" root <<< $(systemctl --user status -l -n 1000 "$1")

So all I need to do is remember to add a line to my systemd units:

OnFailure=failure-email@%n.service

Reactions

Comments can be sent as webmentions or by email.