I tried hard to get this plugin to work. It took a lot of Googling to finally get it to work. Maybe some of these clarifications may eventually work themselves into the readme; but at the very least, it may save you some man hours.
If your plugin isn't activating or is giving you some sort of fatal error, you haven't followed all the steps probably.
The first step is to carefully read the readme. The specific issue is also addressed here by @tmatsuo. You must make a service worker and export the .json key. When you save it, you HAVE to make sure the place you deploy it in a place that isn't public. I usually will make this happen with secrets or simply put it in /etc
, if it's something easy.
The other critical step thing (that isn't mentioned on the readme)requires you to add and edit the first few lines (Lines 34-35) of your gcs.php, as explained here by @CaptainPatate.
$config = ['projectId' => 'Google Project ID'];
$storageClient = new \Google\Cloud\Storage\StorageClient($config);
The last line should already exist at Line 34 or 35, you simply just need to add the $config
inside the parentheses
The final step (which was also pretty critical), was to give the right permissions to the bucket. I created an 'allUsers' permission and created it read and write. I know it's highly advisable not to do this but unfortunately, I couldn't' find any other way. Here's a screenshot of my permissions...
This is what made it work for me. I hope this helps some of you out too.
You could run something like this from command line too set the permissions:
gsutil acl ch -u AllUsers:RW gs://example-bucket
More info on it here: https://cloud.google.com/storage/docs/gsutil/commands/acl
Mods, feel free to close the issue. However, I do think you should consider adding a little more clarification to the readme.