craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 627 forks source link

Asset indexing halts on a missing file #6291

Closed ryanpcmcquen closed 4 years ago

ryanpcmcquen commented 4 years ago

Description

When an asset file is not found, it stops the asset indexing, forcing a restart of the command, I would rather it just logged the error and continued since this operation takes forever.

Steps to reproduce

  1. Have a file that is missing
  2. Run:
    ./craft index-assets/all

Example error:

    > #13147: 5c7e06b534221_3091_darthvader.jpg ... done
    > #13148: 5c7e06b0b84a8_12879_darthvader_1513288997.jpg ... error: File not found at path: 5c7e06b0b84a8_12879_darthvader_1513288997.jpg

Additional info

brandonkelly commented 4 years ago

Can you search for that error in storage/logs/console.log and post the full error details + stack trace?

ryanpcmcquen commented 4 years ago

@brandonkelly:

2020-06-30 10:37:32 [-][-][-][error][craft\errors\VolumeObjectNotFoundException] League\Flysystem\FileNotFoundException: File not found at path: Screen-Shot-2019-10-02-at-3.48.18-PM-de8301d85d3634c4dca27a601aff0bde.png in /var/www/html/vendor/league/flysystem/src/Filesystem.php:389
Stack trace:
#0 /var/www/html/vendor/league/flysystem/src/Filesystem.php(354): League\Flysystem\Filesystem->assertPresent('Screen-Shot-201...')
#1 /var/www/html/vendor/craftcms/cms/src/base/FlysystemVolume.php(58): League\Flysystem\Filesystem->getMetadata('Screen-Shot-201...')
#2 /var/www/html/vendor/craftcms/cms/src/services/AssetIndexer.php(379): craft\base\FlysystemVolume->getFileMetadata('Screen-Shot-201...')
#3 /var/www/html/vendor/craftcms/cms/src/console/controllers/IndexAssetsController.php(151): craft\services\AssetIndexer->indexFile(Object(craft\awss3\Volume), 'Screen-Shot-201...', '30782e47-1055-4...', false, true)
#4 /var/www/html/vendor/craftcms/cms/src/console/controllers/IndexAssetsController.php(76): craft\console\controllers\IndexAssetsController->_indexAssets(Array)
#5 [internal function]: craft\console\controllers\IndexAssetsController->actionAll()
#6 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#7 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#8 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('all', Array)
#9 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(187): yii\console\Controller->runAction('all', Array)
#10 /var/www/html/vendor/yiisoft/yii2/base/Module.php(528): craft\console\Controller->runAction('all', Array)
#11 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('index-assets/al...', Array)
#12 /var/www/html/vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application->runAction('index-assets/al...', Array)
#13 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('index-assets/al...', Array)
#14 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#15 /var/www/html/craft(22): yii\base\Application->run()
#16 {main}

Next craft\errors\VolumeObjectNotFoundException: File not found at path: Screen-Shot-2019-10-02-at-3.48.18-PM-de8301d85d3634c4dca27a601aff0bde.png in /var/www/html/vendor/craftcms/cms/src/base/FlysystemVolume.php:60
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/services/AssetIndexer.php(379): craft\base\FlysystemVolume->getFileMetadata('Screen-Shot-201...')
#1 /var/www/html/vendor/craftcms/cms/src/console/controllers/IndexAssetsController.php(151): craft\services\AssetIndexer->indexFile(Object(craft\awss3\Volume), 'Screen-Shot-201...', '30782e47-1055-4...', false, true)
#2 /var/www/html/vendor/craftcms/cms/src/console/controllers/IndexAssetsController.php(76): craft\console\controllers\IndexAssetsController->_indexAssets(Array)
#3 [internal function]: craft\console\controllers\IndexAssetsController->actionAll()
#4 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#6 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('all', Array)
#7 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(187): yii\console\Controller->runAction('all', Array)
#8 /var/www/html/vendor/yiisoft/yii2/base/Module.php(528): craft\console\Controller->runAction('all', Array)
#9 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('index-assets/al...', Array)
#10 /var/www/html/vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application->runAction('index-assets/al...', Array)
#11 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('index-assets/al...', Array)
#12 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#13 /var/www/html/craft(22): yii\base\Application->run()
#14 {main}
brandonkelly commented 4 years ago

Thanks! We’ll get this fixed.

ryanpcmcquen commented 4 years ago

Thank you!

brandonkelly commented 4 years ago

I was able to reproduce this if a file existed at the start of the command, but then was moved/deleted/renamed before the command got to it. Just released Craft 3.4.26 with a fix for it. The error is still shown but it’s non-blocking.

An error saying that a file is missing.