cms icon indicating copy to clipboard operation
cms copied to clipboard

GCP bucket upload image failed

Open slin1233 opened this issue 1 year ago • 12 comments

Bug description

I am trying to use GCP Bucket to connect to my asset. I was able to implement it, Currently it able to Upload folder, Delete Folder and Delete Pictures but It not uploading picture, When I tried to Upload the image it says it uploaded but it never upload to my gcs bucket or control panel. The preview URI is also Error Not Found When I try uploading which a local driver it works out but not with GCS Buckets. image image

How to reproduce

When I tried to Upload the image it says it uploaded but it never upload to my gcs bucket or control panel. The preview URI is also Error Not Found When I try uploading which a local driver it works out but not with GCS Buckets.

Here is my filesystem setup I tried with and without the storage api uri image

This is my Image.yaml

image

Logs

No response

Environment

Environment
Application Name: Laravel
Laravel Version: 9.52.16
PHP Version: 8.3.0
Composer Version: 2.6.6
Environment: local
Debug Mode: ENABLED
URL: localhost
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: pgsql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 0
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.42.1 PRO

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

None

Additional details

No response

slin1233 avatar Jan 11 '24 20:01 slin1233

Like I mentioned in discord, does it work if you try S3 or Digital Ocean's Spaces?

edalzell avatar Jan 11 '24 23:01 edalzell

We only use GCP for storage - does this mean that 1) it only works with S3 or Digital Ocean Spaces or 2) Just has not been verified and tested to work on GCP? Some clarity would be helpful if possible.

slin1233 avatar Jan 12 '24 03:01 slin1233

I tested on S3 it worked

slin1233 avatar Jan 12 '24 03:01 slin1233

Right, so Statamic uses Laravel's filesystem stuff for this and since it works for S3 (and I know it works for DO Spaces because we use that), then it's something about your GCS configuration that is causing an issue.

edalzell avatar Jan 12 '24 04:01 edalzell

I was able to Fixed that issue it now uploaded to asset but the preview image cant be loaded it the img src is from thumbnail but my asset is store in GCS is there a way to make the src directly connected from cloud storage?

Right now only SVG uses cloud storage when previewing other types are not image image

slin1233 avatar Jan 15 '24 23:01 slin1233

Sounds like a permission issue on your bucket, those images need to be public

edalzell avatar Jan 16 '24 00:01 edalzell

Everything thing is public, the gcs config and my bucket image

slin1233 avatar Jan 16 '24 00:01 slin1233

Anything in your Laravel log file?

duncanmcclean avatar Jan 16 '24 06:01 duncanmcclean

No, Laravel log file is fine image It the thumbnail is not being created created it keep showing broken image is there a way to replace that thumbnail with other url?

slin1233 avatar Jan 16 '24 18:01 slin1233

Everything thing is public, the gcs config and my bucket image

if the images were uploaded BEFORE the bucket was made public (I've made this mistake before), the images will still be private. Can you view the images from their url in a private browser?

edalzell avatar Jan 16 '24 18:01 edalzell

Everything thing is public, the gcs config and my bucket image

if the images were uploaded BEFORE the bucket was made public (I've made this mistake before), the images will still be private. Can you view the images from their url in a private browser?

I tried to open and incognito mode the image opens up for example https://storage.googleapis.com/statamic/image-1-1705428337.jpg but it still showing broken image for thumbnail

Is there a possible way for me to set thumbnail to storage cloud? because I see for my SVG file the thumbnail to set to storage cloud image but my other file type are not image

slin1233 avatar Jan 16 '24 18:01 slin1233

I think I mess up all the thumbnails up I try to look at local disk for asset those images were not showing too, Anyway to fix thumbnails?

slin1233 avatar Jan 16 '24 18:01 slin1233

@slin1233 Are you still running into issues with the thumbnails? Can you try running php please glide:clear to see if that helps with the thumbnails?

duncanmcclean avatar Feb 29 '24 13:02 duncanmcclean

I'm going to close this issue now. The last activity is from mid-January & it's more of a discussion (we only use issues for bugs).

If you need any further help, please open a GitHub Discussion, thanks!

duncanmcclean avatar Mar 28 '24 02:03 duncanmcclean