plank / laravel-mediable

Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel
MIT License
771 stars 101 forks source link

Can not upgrade to new version, I've read all upgrade guides #350

Closed siarheipashkevich closed 7 months ago

siarheipashkevich commented 7 months ago
image image
frasmage commented 7 months ago

The step you are missing is in the upgrade guides and documentation

(optional) If upgrading the intervention/image package to 3.X, be sure to review the upgrading instructions for that package. Notably, the Laravel service providers for configuring the package have been moved to a separate repository intervention/image-laravel

https://laravel-mediable.readthedocs.io/en/latest/variants.html#configure-intervention-image-imagemanager

installing intervention/image-laravel alone is not sufficient, you need to set that package up to define the driver

siarheipashkevich commented 7 months ago

By this documentation https://laravel-mediable.readthedocs.io/en/latest/variants.html#configure-intervention-image-imagemanager I have two choices: 1) install intervention/image-laravel package OR 2) manually bind to the service container needed interfaces as described in you documentation

I prefer 1 option. But!! I can't install this package, when I'm trying to require this package I'm getting an error which I posted in the issue.

frasmage commented 7 months ago

Changed the way that the dependency is bound in 6.0.5, can you confirm that you are able to follow the intervention/image-laravel installation instructions now?

siarheipashkevich commented 7 months ago

1) upgrade laravel-mediable to the latest version 2) try to upgrade intervention/image to the latest version, but getting an error

image
frasmage commented 7 months ago

ok, I see the problem. A bit of a chicken and egg situation in package discovery. Will change it to create a null driver.

frasmage commented 7 months ago

Released 6.1.0 which will attempt to automatically pick a driver while still allowing it to be configured using intervention/image-laravel.

siarheipashkevich commented 7 months ago
[2024-04-09 16:22:02] staging.ERROR: Intervention\Image\ImageManager::__construct(): Argument #1 ($driver) must be of type Intervention\Image\Interfaces\DriverInterface|string, array given, called in /home/forge/api.stage...com/vendor/plank/laravel-mediable/src/MediableServiceProvider.php on line 245 {"exception":"[object] (TypeError(code: 0): Intervention\\Image\\ImageManager::__construct(): Argument #1 ($driver) must be of type Intervention\\Image\\Interfaces\\DriverInterface|string, array given, called in /home/forge/api.stage...com/vendor/plank/laravel-mediable/src/MediableServiceProvider.php on line 245 at /home/forge/api.stage...com/vendor/intervention/image/src/ImageManager.php:22)
[stacktrace]
#0 /home/forge/api.stage...com/vendor/plank/laravel-mediable/src/MediableServiceProvider.php(245): Intervention\\Image\\ImageManager->__construct()
#1 /home/forge/api.stage...com/vendor/plank/laravel-mediable/src/MediableServiceProvider.php(194): Plank\\Mediable\\MediableServiceProvider->getInterventionImageManagerConfiguration()
#2 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Plank\\Mediable\\MediableServiceProvider->Plank\\Mediable\\{closure}()
#3 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build()
#4 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\\Container\\Container->resolve()
#5 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve()
#6 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\\Container\\Container->make()
#7 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(1454): Illuminate\\Foundation\\Application->make()
#8 /home/forge/api.stage...com/vendor/plank/laravel-mediable/src/MediableServiceProvider.php(152): Illuminate\\Container\\Container->offsetGet()
#9 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Plank\\Mediable\\MediableServiceProvider->Plank\\Mediable\\{closure}()
#10 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build()
#11 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\\Container\\Container->resolve()
#12 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve()
#13 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\\Container\\Container->make()
#14 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(1066): Illuminate\\Foundation\\Application->make()
#15 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(982): Illuminate\\Container\\Container->resolveClass()
#16 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(943): Illuminate\\Container\\Container->resolveDependencies()
#17 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build()
#18 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\\Container\\Container->resolve()
#19 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve()
#20 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\\Container\\Container->make()
#21 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Console/Application.php(251): Illuminate\\Foundation\\Application->make()
#22 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Console/Application.php(265): Illuminate\\Console\\Application->resolve()
#23 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php(404): Illuminate\\Console\\Application->resolveCommands()
#24 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Console/Application.php(130): Illuminate\\Support\\ServiceProvider->Illuminate\\Support\\{closure}()
#25 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Console/Application.php(77): Illuminate\\Console\\Application->bootstrap()
#26 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(481): Illuminate\\Console\\Application->__construct()
#27 /home/forge/api.stage...com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Illuminate\\Foundation\\Console\\Kernel->getArtisan()
#28 /home/forge/api.stage...com/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#29 {main}
"} 
siarheipashkevich commented 7 months ago

@frasmage please reopen this issue

frasmage commented 7 months ago

do you have the V2 setup bound within your application like this as was suggested in older versions? You might need to update that to use the new signature

siarheipashkevich commented 7 months ago

I've updated to the latest versions for all packages, but in the stage my deploy is failed

image
siarheipashkevich commented 7 months ago

There is my deployment script:

image
frasmage commented 7 months ago

found it, typo in the class name GD vs. Gd, which didn't fail when I tested it on a case-insensitive drive.

Addressed in 6.1.1

siarheipashkevich commented 7 months ago

Thanks a lot. I will update soon

siarheipashkevich commented 7 months ago

@frasmage it is not fixed (

image
frasmage commented 7 months ago

Are you sure that you have version 6.1.1? I recreated an environment with the same versions you listed above and am no longer able to reproduce the issue.

The screenshot above indicated that your lock file might not be aligned with your composer.json (^6.1 required vs 6.0.3 actual). Be sure to run composer update plank/laravel-mediable before committing and deploying

siarheipashkevich commented 7 months ago

@frasmage yes, sorry. This issue happened after the first failed deployment (where the version has typo), therefore when I update the version and pushed to the remote repository I try to deploy one more time. If you see my deployment script where I have some instructions for clearing cache and something else and only after that I'm installing packages.

Thanks for your helping!