laravel-google-cloud-storage icon indicating copy to clipboard operation
laravel-google-cloud-storage copied to clipboard

Driver [gcs] is not supported.

Open aCodeAlchemist opened this issue 3 years ago • 3 comments

I am trying to access last modified date of a particular file:

$disk = Storage::disk('gcs');
$info = $disk->lastModified('file.jpg');

And I am getting the error I mentioned in title.

I am Using following version for libraries:

    "php": "^7.2.5",
    "fideloper/proxy": "^4.2",
    "fruitcake/laravel-cors": "^2.0",
    "guzzlehttp/guzzle": "^6.3",
    "laravel/framework": "^7.0",
    "laravel/horizon": "^4.3",
    "laravel/tinker": "^2.0",
    "predis/predis": "^1.1",
    "sentry/sentry-laravel": "^1.8",
    "superbalist/laravel-google-cloud-storage": "^2.2.3"

And I have configured filesystems.php as mentioned below:

'disks' => [
    'gcs' => [
        'driver' => 'gcs',
        'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'),
        'key_file' => env('GOOGLE_CLOUD_KEY_FILE', public_path('production.json')), // optional: /path/to/service-account.json
        'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'your-bucket'),
        'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', null), // optional: /default/path/to/apply/in/bucket
        'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below
        'visibility' => 'public', // optional: public|private
    ],
]

I have tried clearing cache and config

php artisan config:clear
php artisan cache:clear

It still doesn't work.

What am I doing wrong? Am I missing anything?

aCodeAlchemist avatar Jul 28 '20 18:07 aCodeAlchemist

Looks like the package Service Provider isn't being loaded.

Have you tried running php artisan package:discover or manually registering the Service Provider in config/app.php under

'providers' => [
        ...
]

composer dump-autoload should also trigger the php artisan package:discover

Rkallenkoot avatar Aug 04 '20 14:08 Rkallenkoot

Same issue here. When running artisan package:discover I get the following:

Discovered Package: superbalist/laravel-google-cloud-storage
Package manifest generated successfully.

After manually adding the service provider to config/app.php it works.

DieterHolvoet avatar Dec 28 '20 16:12 DieterHolvoet

Seems like a composer related issue. It was not registering the package. It did work before. After installing the lib again it worked...

Airgerr avatar Jun 20 '22 17:06 Airgerr