spatie / laravel-google-cloud-storage

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

Laravel 9.2 Issue #10

Closed andreladocruz closed 2 years ago

andreladocruz commented 2 years ago

Hi,

I'm using it in my Laravel 9 project with the following code:

image

the put method returns false and no file is created.

No exception thrown.

Any help?

andreladocruz commented 2 years ago

Found the issue. =P

change "key_file" to "key_file_path" in filesystems.php

Sorry

MatheusAparecido commented 2 years ago

Hey @andreladocruz how are you?

I'm having the exact same issue. That's how I declared the configs on my filesystems.php.

image

How did you fixed it?

andreladocruz commented 2 years ago

I think you must use only one key.

key_file_path or key_file.

image

MatheusAparecido commented 2 years ago

@andreladocruz Didn't work :( Would it possible be a misconfiguration in my bucket?

When I try to debug my storage var, it keeps returning false.

image

image

andreladocruz commented 2 years ago

I think $request->file is an object and has a method called "storePubliclyAs".

ghike commented 2 years ago

I'm working with @MatheusAparecido on a solution for this problem.

What we already tried:

Using both methods returned "false" as response when we're debugging the $disk->put('folder/', $image) method. But when we try to retrieve files from the blobstorage, we receive them sucessfully.

@andreladocruz @AlexVanderbist any possible issues that could be causing this? :(

andreladocruz commented 2 years ago

Has the file is been written to GCS?

I really did not check the result of a successful write.

ghike commented 2 years ago

Well, after two days trying to solve this problem, we decided to port our project back to Laravel 8 (since we had the GCS implemented in other projects in this version).

jacksontong commented 2 years ago

for me the put method always return false while can I still make a directory \Illuminate\Support\Facades\Storage::makeDirectory()

jacksontong commented 2 years ago

I found that you can add throw to config so put will throw exception rather than return false

'gcs' => [
            'driver' => 'gcs',
            'throw' => true,
]

In my case the error is

"message": "Cannot insert legacy ACL for an object when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access"