spacecatninja / craft-imager-x

Image transforms, optimizations and manipulations for your Craft CMS site.
Other
26 stars 16 forks source link

Deprecated shardStrategy causes asset sources to not load #18

Closed mijewe closed 4 years ago

mijewe commented 4 years ago

I'm submitting a...

Steps to reproduce

  1. Create a new blank site
  2. Install Imager X
  3. Go to admin -> assets
  4. You'll see "A server error occurred.", and your sources won't load.
  5. In your logs you'll see "craft\errors\DeprecationException: The shardStrategy config setting for Imgix has been deprecated and should be removed."

Description

Asset sources can't be loaded in the CMS. I believe due to the deprecated shardStrategy config setting having a default value of "cycle", and failing a !== null test.

Displayed errors, stack trace, relevant logs

`2020-03-20 07:55:12 [-][10][-][error][craft\errors\DeprecationException] craft\errors\DeprecationException: The `shardStrategy` config setting for Imgix has been deprecated and should be removed. - cycle in /Users/mijewe/xxx/xxx/vendor/spacecatninja/imager-x/src/services/ImgixService.php:76
Stack trace:
#0 /Users/mijewe/xxx/xxx/vendor/spacecatninja/imager-x/src/models/ImgixSettings.php(38): craft\services\Deprecator->log('spacecatninja\\i...', 'The `shardStrat...')
#1 /Users/mijewe/xxx/xxx/vendor/spacecatninja/imager-x/src/services/ImgixService.php(76): spacecatninja\imagerx\models\ImgixSettings->__construct(Array)
#2 /Users/mijewe/xxx/xxx/vendor/spacecatninja/imager-x/src/ImagerX.php(322): spacecatninja\imagerx\services\ImgixService::getCanPurge()
#3 [internal function]: spacecatninja\imagerx\ImagerX::spacecatninja\imagerx\{closure}(Object(craft\events\RegisterElementActionsEvent))
#4 /Users/mijewe/xxx/xxx/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(craft\events\RegisterElementActionsEvent))
#5 /Users/mijewe/xxx/xxx/vendor/craftcms/cms/src/base/Element.php(479): yii\base\Event::trigger('craft\\elements\\...', 'registerActions', Object(craft\events\RegisterElementActionsEvent))
#6 /Users/mijewe/xxx/xxx/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(559): craft\base\Element::actions('folder:e71eec5c...')
#7 /Users/mijewe/xxx/xxx/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(107): craft\controllers\ElementIndexesController->availableActions()
#8 /Users/mijewe/xxx/xxx/vendor/yiisoft/yii2/base/Controller.php(155): craft\controllers\ElementIndexesController->beforeAction(Object(yii\base\InlineAction))
#9 /Users/mijewe/xxx/xxx/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('get-elements', Array)
#10 /Users/mijewe/xxx/xxx/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('get-elements', Array)
#11 /Users/mijewe/xxx/xxx/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('element-indexes...', Array)
#12 /Users/mijewe/xxx/xxx/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('element-indexes...', Array)
#13 /Users/mijewe/xxx/xxx/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#14 /Users/mijewe/xxx/xxx/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#15 /Users/mijewe/xxx/xxx/web/index.php(21): yii\base\Application->run()
#16 /Users/mijewe/.composer/vendor/laravel/valet/server.php(158): require('/Users/mijewe...')
#17 {main}`

Additional info

aelvan commented 4 years ago

Thanks for reporting. I fixed the default example Imgix config which triggered this.

It's also worth nothing that this would only happen if you've explicitly turned on that the deprecator component should throw errors in your app.php.

mijewe commented 4 years ago

Nice one - thanks for the speedy action!