laravel-backup: File Not Found Exception Message when using Google Drive

I am using the google drive adapter from https://github.com/nao-pon/flysystem-google-drive

The adapter itself seems to be working as it should. For instance, a test route that saves a simple file and it is stored correctly.

Route::get('test', function() {
    Storage::disk('google')->put('test.txt', 'Hello World');
});

When I run php artisan backup:run I get the following error:

{
    "error": {
         "errors": [
             {
                 "domain": "global",
                 "reason": "notFound",
                 "message": "File not found: .",
                 "locationType": "parameter",
                 "location": "fileId"
            }
        ],
        "code": 404,
        "message": "File not found: ."
    }
}

There is more to the error dump but that seems to be the relevant information.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 37 (7 by maintainers)

Most upvoted comments

That error is because you can’t use the folder name you have to get the folder ID of the google drive folder, that’s because google drive allow duplicated names, so the unique name in that case is the id, create a folder on google drive and open that folder, now go to the url:

https://drive.google.com/drive/u/1/folders/id_of_the_folder

Now configure the file like this:

‘backup’ => [

    /*
     * The name of this application. You can use this name to monitor
     * the backups.
     */
    'name' => 'id_of_the_folder',

Hi everyone, I tested creating a backup on google drive and it works. But there are 2 following notes:

  • It works if you don’t want to store the zip in a specific folder. Just specify the folderID as null and in the package’s config backup.php specify the name as blank ''. You don’t need to modify package’s source code for this. This is because google uses the folder ID’s as an identifier as names could be similar.
  • We will try to resolve and find an appropriate solution for this. Do share any suggestions or PR’s you have regarding this issue 😃

I had the same problem and here is my solution: File Not Found Exception throws on line 85 of Spatie\Backup\BackupDestination\BackupDestination file. In line 81 of that file $this->backupName added to file destination to create a directory named app url. So google drive don’t support this type of creating directory. To resolve you may set config(‘laravel-backup.backup.name’) to empty ( ‘’ ).

i also have same issue but solution just pass empty name like this ` ‘backup’ => [

    /*
     * The name of this application. You can use this name to monitor
     * the backups.
     */
    'name' => config('GOOGLE_DRIVE_FOLDER_ID' , ''),

    'source' => [` 

the issue is that we are passing name most of time on upload name not match and it gives error when you pass null then it store that backup which is created at that time

someone knows how to avoid that the deleted backups land in trash and fill up storage anyway?