cloudinary-community / cloudinary-laravel

Laravel SDK for Cloudinary
MIT License
255 stars 71 forks source link

NotSupportingVisibilityTrait not found #83

Closed Mdhesari closed 1 year ago

Mdhesari commented 1 year ago

Hey there

I've been using cloudinary-laravel for a while and after updating to laravel 9.x I get this error.

It seems that league/flysystem team have removed this trait and interface.

unicodeveloper commented 1 year ago

@Mdhesari Please make sure you update the package version to at least 2.0.0. Only the v2 works with Laravel 9.

Mdhesari commented 1 year ago

@unicodeveloper I've tried that and still no hope

unicodeveloper commented 1 year ago

I just tried it now locally and it works. Can I see your composer.json? or is there a way you can reproduce it in a repo and send the link? @Mdhesari

Mdhesari commented 1 year ago

"league/flysystem": "^2.0.0"

this is the way I require it but it install 2.5

is it correct?

@unicodeveloper

unicodeveloper commented 1 year ago

Just to be sure. Is there a reason why you are manually requiring this package league/flysystem ?

Mdhesari commented 1 year ago

I was trying to use the cloudinary package for laravel 9 but it seems that laravel is locked to league/flysystem 3.*

Mdhesari commented 1 year ago

So I think we need to update CloudinaryAdapter class in order to fix the problem

unicodeveloper commented 1 year ago

Yes laravel 9 is locked to league/flysystem 3.* @Mdhesari

Mdhesari commented 1 year ago

Do you have any idea what we changes we could make in order to make it work with the new version of league/flsystem

unicodeveloper commented 1 year ago

In the latest version of CloudinaryAdapter, I also follow the v3 rules of league/flysystem. In fact, I released a version 2 of this package just to work with Laravel 9 and Flystem 3. So we don't need to update anything

unicodeveloper commented 1 year ago

@Mdhesari What I need to understand is: Why are you trying to use a lower version of league/flystem? Because if you indeed want to use Laravel 9, you shouldn't use a lower version.

Mdhesari commented 1 year ago

@unicodeveloper

Man I'm a fool :))

I thought you don't have new version for laravel 9 so I was trying to make the older version work with laravel 9

unicodeveloper commented 1 year ago

Hahahaha, you're not a fool. I guess you just misunderstood it. I'm glad you have figured it out now @Mdhesari 💯

Mdhesari commented 1 year ago

@unicodeveloper Thank you by the way ❤️

unicodeveloper commented 1 year ago

You are welcome @Mdhesari ❤️

Mdhesari commented 1 year ago

@unicodeveloper

do you have any changelog for new version?

Mdhesari commented 1 year ago

@unicodeveloper

after updating the package I get this error "Invalid configuration, please set up your environment"

unicodeveloper commented 1 year ago

It's in the releases log here

unicodeveloper commented 1 year ago

@Mdhesari do you have this CLOUDINARY_URL=xxxxxxxxx in your .env file?

where xxxxxx is the cloudinary url gotten from your cloudinary dashboard

Mdhesari commented 1 year ago

@unicodeveloper yess I have them all

unicodeveloper commented 1 year ago

Follow the installation guide again and be sure you have everything. It throws that error when it can't see or recognize your cloudinary config details @Mdhesari

Mdhesari commented 1 year ago

@unicodeveloper I hadn't this issue before and my env variables are available.

I've cleared cache and still get this error.

even checked it in my tinker and it gets the cloudinary_url correctly

unicodeveloper commented 1 year ago

Maybe you need to do a composer dump-autoload. Delete your composer.lock and do a clean composer install with the v2 version.

Mdhesari commented 1 year ago

@unicodeveloper I've almost done everything :))

when something doesn't want to work just it doesn't 😆

Mdhesari commented 1 year ago

did you change any configuration stuff? @unicodeveloper

unicodeveloper commented 1 year ago

I did not. @Mdhesari

unicodeveloper commented 1 year ago

This is a laravel repo I just created.

Clone, do a composer install, ensure the .env file has the right cloudinary values and run php artisan serve

You can use it as an example to inspect yours and figure out what's wrong @Mdhesari

Mdhesari commented 1 year ago

@unicodeveloper

I've find out the problem that was about cloudinary name

fixed it by adding this to my app service provider register()

    Configuration::instance(['cloud' => ['cloud_name' => env('CLOUDINARY_NAME'))]]);
unicodeveloper commented 1 year ago

Interesting. If you have config/cloudinary.php and your CLOUDINARY_URL in your env has the right value, then I am not sure you would have needed to do that though.

Mdhesari commented 1 year ago

@unicodeveloper

yeah it was working before but now I was amazed too!

brenjt commented 1 month ago

Any plans on updating this bug? It still exists on 2.1.0 and no new versions have been released.

unicodeveloper commented 1 month ago

@brenjt please did you try it with the example repo I added in this thread?

I can't seem to reproduce the error on my end

jayjfletcher commented 1 month ago

@unicodeveloper I can confirm there is a break when upgrading from 2.0 to 2.1, It looks like there was some regression.

Please look at src/CloudinaryAdapter.php from 1.0 -> 2.0-> 2.1 specifically the use of NotSupportingVisibilityTrait which doesn't exist anymore

There was definitely code regression.