Code Monkey home page Code Monkey logo

Comments (11)

parallels999 avatar parallels999 commented on July 22, 2024

Did you follow all implementation steps ??

Here a tutorial: laravel-google-drive-ext-demo

from flysystem-google-drive-ext.

RichardDight avatar RichardDight commented on July 22, 2024

Yes I've followed the steps:

  1. Added a google drive storage provider
  2. Added drive credentials to .env
  3. Added custom adapter & added a custom service provider
  4. registered a google file system disk

Everything is working fine when I'm not using GOOGLE_DRIVE_TEAM_DRIVE_ID . And as stated, the zip with the sql file is created and then this error occurs ^

Drive SDK permissions within the google organisation is also set to 'ON'

from flysystem-google-drive-ext.

parallels999 avatar parallels999 commented on July 22, 2024

what are you setting in folder? wich options are you setting?
Show some code, wich versions are you using?
i'm just guessing
Also manually copying files to google disk works?

from flysystem-google-drive-ext.

RichardDight avatar RichardDight commented on July 22, 2024

The only option I'm setting is the teamDriveId.

array:1 [▼ "teamDriveId" => "0YBee_YovmGFHUk9ANC" ]

I can see the drive listed $googleDisk->getAdapter()->getService()->teamdrives->listTeamdrives()->getTeamDrives() here.

Define manually?
I can successfully Storage::cloud()->put() with a new file or an existing image to the team drive successfully

from flysystem-google-drive-ext.

RichardDight avatar RichardDight commented on July 22, 2024

This is the function that's throwing the exception:

    protected function copyToBackupDestinations(string $path): void
    {
        $this->backupDestinations
            ->each(function (BackupDestination $backupDestination) use ($path) {
                try {
                    if (! $backupDestination->isReachable()) {
                        throw new Exception("Could not connect to disk {$backupDestination->diskName()} because: {$backupDestination->connectionError()}");
                    }

                    consoleOutput()->info("Copying zip to disk named {$backupDestination->diskName()}...");
                    
                    $backupDestination->write($path);

                    consoleOutput()->info("Successfully copied zip to disk named {$backupDestination->diskName()}.");

                    $this->sendNotification(new BackupWasSuccessful($backupDestination));
                } catch (Exception $exception) {
                    consoleOutput()->error("Copying zip failed because: {$exception->getMessage()}.");

                    $this->sendNotification(new BackupHasFailed($exception, $backupDestination));

                    throw $exception;
                }
            });

Here is the backup destination I'm using:

Spatie\Backup\BackupDestination\BackupDestination {#1678 ▼

  #disk: Illuminate\Filesystem\FilesystemAdapter {#1676 ▼
  
    #driver: League\Flysystem\Filesystem {#1673 ▼
    
      -config: League\Flysystem\Config {#1674 ▼
        -options: []
      }
      -pathNormalizer: League\Flysystem\WhitespacePathNormalizer {#1675}
      -adapter: Masbug\Flysystem\GoogleDriveAdapter {[#1671 ▼]
      (https://github.com/masbug/flysystem-google-drive-ext/issues/103#sf-dump-1940293931-ref21671)
        #service: Google\Service\Drive {#1653 ▶}
        
        #spaces: "drive"
        #root: "0YBee_YovmGFHUk9ANC"
        #publishPermission: array:3 [▶]
        
        -cacheFileObjects: array:6 [▶]
        
        -cacheHasDirs: array:1 [▶]
        
        -useHasDir: false
        -usePermanentDelete: false
        -useSinglePathTransaction: false
        
        -options: array:12 [▼
          "spaces" => "drive"
          "useHasDir" => false
          "useDisplayPaths" => true
          "usePermanentDelete" => false
          "useSinglePathTransaction" => false
          "publishPermission" => array:3 [▶]
          "appsExportMap" => array:6 [▶]
          "parameters" => []
          "driveId" => null
          "sanitize_chars" => array:57 [▶]
          "sanitize_replacement_char" => "_"
          "teamDriveId" => "0AAle_YovmDGHUk9PVA"
        ]
        -useDisplayPaths: true
        -rootId: null
        -cachedPaths: []
        -requestedIds: []
        -optParams: array:9 [▶]
        -prefixer: League\Flysystem\PathPrefixer {#1672 ▶}
      }
      -publicUrlGenerator: null
      -temporaryUrlGenerator: null
    }
    #adapter: Masbug\Flysystem\GoogleDriveAdapter {[#1671 ▶](https://github.com/masbug/flysystem-google-drive-ext/issues/103#sf-dump-1940293931-ref21671)}
    #config: []
    #prefixer: League\Flysystem\PathPrefixer {#1677 ▶}
    #temporaryUrlCallback: null
  }
  #diskName: "google"
  #backupName: ""
  +connectionError: null
  #backupCollectionCache: null
}

from flysystem-google-drive-ext.

parallels999 avatar parallels999 commented on July 22, 2024

I can successfully Storage::cloud()->put() with a new file or an existing image to the team drive successfully

Weird, i am using spatie/laravel-backup without problems
"teamDriveId" is already deprecated, it was changed to "driveId" wich here is null

'driveId' => $teamDriveId

On folder did you set / or null

from flysystem-google-drive-ext.

RichardDight avatar RichardDight commented on July 22, 2024

I can successfully Storage::cloud()->put() with a new file or an existing image to the team drive successfully

Weird, i am using spatie/laravel-backup without problems "teamDriveId" is already deprecated, it was changed to "driveId" wich here is null

'driveId' => $teamDriveId

On folder did you set / or null

Hmm, you're right. Seems like the code for teamDriveId still exists though for now, no?
I see in the demo you linked, in the service provider that $options['teamdriveId'] = $config['teamDriveId']; is also being passed there.

When I change this to driveId the backup no longer targets the team directory, and goes straight into my root directory.

my folder is currently null, however I pass '/' $config['folder'] ?? '/' like so

from flysystem-google-drive-ext.

parallels999 avatar parallels999 commented on July 22, 2024

So, it is fixed now?? I don't have more ideas, try to do a debug

from flysystem-google-drive-ext.

parallels999 avatar parallels999 commented on July 22, 2024

Maybe this #57

from flysystem-google-drive-ext.

RichardDight avatar RichardDight commented on July 22, 2024

Debugging atm. Still not fixed. Have no issues with what was mentioned in #57

from flysystem-google-drive-ext.

RichardDight avatar RichardDight commented on July 22, 2024

Fixed the issue.

So replacing the option['teamDriveId'] with option['driveId'] yesterday didn't work. I added an additional option just now having both 'teamDriveId' and also 'driveId' and that solved the issue.

                if (isset($config['teamDriveId'])) {
                    $options['teamDriveId'] = $config['teamDriveId'];
                    $options['driveId'] = $config['teamDriveId'];
                }

Thanks for assisting, I appreciate it

from flysystem-google-drive-ext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.