spatie / laravel-google-cloud-storage

Google Cloud Storage filesystem driver for Laravel
https://spatie.be/open-source
MIT License
195 stars 51 forks source link

Invalid visibility provided #95

Closed owuraku closed 3 months ago

owuraku commented 3 months ago

Discussed in https://github.com/spatie/laravel-google-cloud-storage/discussions/94

Originally posted by **owuraku** August 16, 2024 I get this error when using the adaptor on a Statamic website. Invalid visibility provided. Expected either League\Flysystem\Visibility::PUBLIC or League\Flysystem\Visibility::PRIVATE, received 'public' ```Invalid visibility provided. Expected either League\Flysystem\Visibility::PUBLIC or League\Flysystem\Visibility::PRIVATE, received 'public' {"userId":"7ebf979e-d7d7-4b0f-99d6-0241d5e77a35","exception":"[object] (League\\Flysystem\\InvalidVisibilityProvided(code: 0): Invalid visibility provided. Expected either League\\Flysystem\\Visibility::PUBLIC or League\\Flysystem\\Visibility::PRIVATE, received 'public' at /Users/owuraku/Repositories/statamic-tuts/vendor/league/flysystem/src/InvalidVisibilityProvided.php:18) [stacktrace] #0 /Users/owuraku/Repositories/statamic-tuts/vendor/league/flysystem/src/PortableVisibilityGuard.php(14): League\\Flysystem\\InvalidVisibilityProvided::withVisibility('public', 'either League\\\\F...') #1 /Users/owuraku/Repositories/statamic-tuts/vendor/league/flysystem/src/UnixVisibility/PortableVisibilityConverter.php(23): League\\Flysystem\\PortableVisibilityGuard::guardAgainstInvalidInput('public') #2 /Users/owuraku/Repositories/statamic-tuts/vendor/league/flysystem-local/LocalFilesystemAdapter.php(375): League\\Flysystem\\UnixVisibility\\PortableVisibilityConverter->forFile('public') #3 /Users/owuraku/Repositories/statamic-tuts/vendor/league/flysystem-local/LocalFilesystemAdapter.php(134): League\\Flysystem\\Local\\LocalFilesystemAdapter->setVisibility('/Users/owuraku/...', 'public') #4 /Users/owuraku/Repositories/statamic-tuts/vendor/league/flysystem-local/LocalFilesystemAdapter.php(112): League\\Flysystem\\Local\\LocalFilesystemAdapter->writeToFile('new-f/screensho...', Resource id #160, Object(League\\Flysystem\\Config)) #5 /Users/owuraku/Repositories/statamic-tuts/vendor/league/flysystem/src/Filesystem.php(67): League\\Flysystem\\Local\\LocalFilesystemAdapter->writeStream('new-f/screensho...', Resource id #160, Object(League\\Flysystem\\Config)) #6 /Users/owuraku/Repositories/statamic-tuts/vendor/league/flysystem/src/MountManager.php(404): League\\Flysystem\\Filesystem->writeStream('new-f/screensho...', Resource id #160, Array) ``` This is my configuration : ``` 'gcs' => [ 'driver' => 'gcs', 'root' => '', 'key_file_path' => base_path('key.json'), // optional: /path/to/service-account.json 'key_file' => null, 'url' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), 'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'), // optional: is included in key file 'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'sbc-asset-bucket'), 'path_prefix' => '', // optional: /default/path/to/apply/in/bucket 'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), //'https://storage.googleapis.com/sbc-asset-bucket/', //env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below 'apiEndpoint' => env('GOOGLE_CLOUD_STORAGE_API_ENDPOINT', null), // set storageClient apiEndpoint 'visibility' => \League\Flysystem\Visibility::PUBLIC, // optional: public|private 'visibility_handler' => \League\Flysystem\GoogleCloudStorage\UniformBucketLevelAccessVisibility::class, 'metadata' => ['cacheControl' => 'public,max-age=86400'], 'disable_asserts' => true, ], ``` My composer.json ``` "require": { "php": "^8.1", "aerni/advanced-seo": "^2.2", "anakadote/statamic-recaptcha": "^1.0", "aryehraber/statamic-logbook": "^3.1", "firebase/php-jwt": "^6.8", "guzzlehttp/guzzle": "^7.8", "insight-media/statamic-google-analytics": "^2.1", "kudashevs/laravel-share-buttons": "^4.0", "laravel/framework": "^10.8", "laravel/sanctum": "^3.2", "laravel/socialite": "^5.9", "laravel/tinker": "^2.8", "league/flysystem-aws-s3-v3": "^3.16", "socialiteproviders/google": "^4.1", "spatie/browsershot": "^3.59", "spatie/laravel-google-cloud-storage": "^2.3", "statamic/cms": "^4.0", "twbs/bootstrap-icons": "^1.11", "webographen/statamic-admin-log": "^1.0" } ```
freekmurze commented 3 months ago

Let's keep it in discussions