Verbindung zu Google Cloud Storage

Hallo, ich würde gerne meine Medien alle auf dem GCP Bucket verwalten. 

Shopware Version 6.2.2

 

config/packages/shopware.yml:

shopware:
  cdn:
    url: "https://storage.googleapis.com/xyz-ressources/"
    strategy: "md5"
  filesystem:
    public:
      type: "google-storage"
      config:
        bucket: "xyz-ressources"
        keyFilePath: "/var/www/gcp_storage_key/json-key.json"
        projectId: "XXXX"

 

Und beim Befehl: bin/console theme:compile bekomme ich folgende fehlermeldung:

15:49:16 ERROR [console] Error thrown while running command "theme:compile -vvv". Message: "League\Flysystem\Filesystem::putStream expects argument #2 to be a valid resource."
[
  "exception" => InvalidArgumentException {
    #message: "League\Flysystem\Filesystem::putStream expects argument #2 to be a valid resource."
    #code: 0
    #file: "./vendor/league/flysystem/src/Filesystem.php"
    #line: 111
    trace: {
      ./vendor/league/flysystem/src/Filesystem.php:111 { …}
      ./vendor/shopware/core/Framework/Adapter/Filesystem/Plugin/CopyBatch.php:35 { …}
      Shopware\Core\Framework\Adapter\Filesystem\Plugin\CopyBatch->handle() {}
      ./vendor/league/flysystem/src/Plugin/PluggableTrait.php:72 { …}
      ./vendor/league/flysystem/src/Plugin/PluggableTrait.php:88 { …}
      ./vendor/shopware/storefront/Theme/ThemeCompiler.php:166 { …}
      ./vendor/shopware/storefront/Theme/ThemeCompiler.php:128 { …}
      ./vendor/shopware/storefront/Theme/ThemeService.php:82 { …}
      ./vendor/shopware/storefront/Theme/Command/ThemeCompileCommand.php:57 { …}
      ./vendor/symfony/console/Command/Command.php:255 { …}
      ./vendor/symfony/console/Application.php:1030 { …}
      ./vendor/symfony/framework-bundle/Console/Application.php:97 { …}
      ./vendor/symfony/console/Application.php:272 { …}
      ./vendor/symfony/framework-bundle/Console/Application.php:83 { …}
      ./vendor/symfony/console/Application.php:148 { …}
      ./bin/console:68 {
        › $application = new Application($kernel->getKernel());
        › $application->run($input);
        › 
        arguments: {
          $input: Symfony\Component\Console\Input\ArgvInput {#1 …}
        }
      }
    }
  },
  "command" => "theme:compile -vvv",
  "message" => "League\Flysystem\Filesystem::putStream expects argument #2 to be a valid resource."
]
15:49:16 DEBUG [console] Command "theme:compile -vvv" exited with code "1"
[
  "command" => "theme:compile -vvv",
  "code" => 1
]

In Filesystem.php line 111:
                                                                                      
  [InvalidArgumentException]                                                          
  League\Flysystem\Filesystem::putStream expects argument #2 to be a valid resource.  
                                                                                      

Exception trace:
  at /var/www/public/vendor/league/flysystem/src/Filesystem.php:111
 League\Flysystem\Filesystem->putStream() at /var/www/public/vendor/shopware/core/Framework/Adapter/Filesystem/Plugin/CopyBatch.php:35
 Shopware\Core\Framework\Adapter\Filesystem\Plugin\CopyBatch->handle() at n/a:n/a
 call_user_func_array() at /var/www/public/vendor/league/flysystem/src/Plugin/PluggableTrait.php:72
 League\Flysystem\Filesystem->invokePlugin() at /var/www/public/vendor/league/flysystem/src/Plugin/PluggableTrait.php:88
 League\Flysystem\Filesystem->__call() at /var/www/public/vendor/shopware/storefront/Theme/ThemeCompiler.php:166
 Shopware\Storefront\Theme\ThemeCompiler->copyAssets() at /var/www/public/vendor/shopware/storefront/Theme/ThemeCompiler.php:128
 Shopware\Storefront\Theme\ThemeCompiler->compileTheme() at /var/www/public/vendor/shopware/storefront/Theme/ThemeService.php:82
 Shopware\Storefront\Theme\ThemeService->compileTheme() at /var/www/public/vendor/shopware/storefront/Theme/Command/ThemeCompileCommand.php:57
 Shopware\Storefront\Theme\Command\ThemeCompileCommand->execute() at /var/www/public/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/public/vendor/symfony/console/Application.php:1030
 Symfony\Component\Console\Application->doRunCommand() at /var/www/public/vendor/symfony/framework-bundle/Console/Application.php:97
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/public/vendor/symfony/console/Application.php:272
 Symfony\Component\Console\Application->doRun() at /var/www/public/vendor/symfony/framework-bundle/Console/Application.php:83
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/public/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/public/bin/console:68

 

 

Ich weiß nicht, warum ich so einen Fehler bekomme. Ich habe einen weiteren SW6 Shop am laufen (version 6.1.5) und dort funktioniert es ohne Probleme. Hat jemand eine Idee?

Ich konnte keine Plugins mehr aktivieren und habe den gleichen Fehler bekommen.

Ich verstehe nicht, warum man keine funktionierenden Praxisbeispiele einbauen kann. Ständig muss man sich aus so rudimentär hingerotzten Versatzstücken alles selber zusammenreimen.

Im How-To steht:

Under this key you can separately define your storage for the public, private, theme, sitemap and asset (bundle assets).

Dass man aber zwingend ALLE Adapter konfigurieren muss, geht aus der Doku doch überhaupt nicht hervor. Hört sich ja eher so an, als könne man wenn man wollte, nur einzelne Adapter konfigurieren.

Sorry für den Rant aber wie viel Zeit ich jetzt wieder, nur wegen der absolut unzureichenden und besch***enen Doku, verschwendet habe…

1 „Gefällt mir“

Hi, 

ich hatte das gleiche Problem. Siehe mein Pull Request, vielleicht hilft das: bugfix filesystem with google storage by pawelnapierala · Pull Request #1 · pawelnapierala/platform · GitHub

Dabei habe ich noch folgendes Problem mit Google Storage gehabt: 

In RequestWrapper.php line 368:
                                                                                                      
  [Google\Cloud\Core\Exception\NotFoundException (404)]                                               
  {                                                                                                   
    "error": {                                                                                        
      "code": 404,                                                                                    
      "message": "No such object: xxxxx/bundles/storefront/administration/css/",      
      "errors": [                                                                                     
        {                                                                                             
          "message": "No such object: xxxxx/bundles/storefront/administration/css/",  
          "domain": "global",                                                                         
          "reason": "notFound"                                                                        
        }                                                                                             
      ]                                                                                               
    }                                                                                                 
  }

Hier die Lösung: Bugfix AssetService with Google Storage by pawelnapierala · Pull Request #2 · pawelnapierala/platform · GitHub

Hey @AlexGalax,

 

hast du eine Beschreibung in welchem Schlüssel und was du gemacht hast, damit das Problem behoben wurde. Stehe vor demselben Problem und werde wahnsinnig. 

 

Danke!

 

@AlexGalax schrieb:

Ich konnte keine Plugins mehr aktivieren und habe den gleichen Fehler bekommen.

Ich verstehe nicht, warum man keine funktionierenden Praxisbeispiele einbauen kann. Ständig muss man sich aus so rudimentär hingerotzten Versatzstücken alles selber zusammenreimen.

Im How-To steht:

Under this key you can separately define your storage for the public, private, theme, sitemap and asset (bundle assets).

Dass man aber zwingend ALLE Adapter konfigurieren muss, geht aus der Doku doch überhaupt nicht hervor. Hört sich ja eher so an, als könne man wenn man wollte, nur einzelne Adapter konfigurieren.

Sorry für den Rant aber wie viel Zeit ich jetzt wieder, nur wegen der absolut unzureichenden und besch***enen Doku, verschwendet habe…