I'm running into this error on every deploy. I always have to manually SSH into the server, php please stache:clear, and run the deployment again. No idea why this is happening.
I'm using Ploi to deploy. It's very similar to Forge. This is the deploy script:
git pull origin master
npm install
npm run production
echo "🛠Assets built successfully!"
composer install --no-interaction --prefer-dist --optimize-autoloader
echo "🎛 Composer dependencies installed successfully!"
echo "" | sudo -S service php7.4-fpm reload
echo "🚀 Application deployed!"
php artisan optimize
php please static:clear
php please stache:refresh
This is the stacktrace:
[2020-10-30 09:56:11] testing.ERROR: Call to a member function hasStructure() on null {"exception":"[object] (Error(code: 0): Call to a member function hasStructure() on null at /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/CollectionEntriesStore.php:130)
[stacktrace]
#0 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/CollectionEntriesStore.php(125): Statamic\\Stache\\Stores\\CollectionEntriesStore->removeEntryFromStructure()
#1 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/Store.php(223): Statamic\\Stache\\Stores\\CollectionEntriesStore->handleDeletedItem()
#2 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(230): Statamic\\Stache\\Stores\\Store->Statamic\\Stache\\Stores\\{closure}()
#3 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/Store.php(225): Illuminate\\Support\\Collection->each()
#4 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/Store.php(38): Statamic\\Stache\\Stores\\Store->handleFileChanges()
#5 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/CollectionsStore.php(81): Statamic\\Stache\\Stores\\Store->index()
#6 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Repositories/CollectionRepository.php(83): Statamic\\Stache\\Stores\\CollectionsStore->updateEntryUris()
#7 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Statamic\\Stache\\Repositories\\CollectionRepository->updateEntryUris()
#8 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Entries/Collection.php(337): Illuminate\\Support\\Facades\\Facade::__callStatic()
#9 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/CollectionsStore.php(94): Statamic\\Entries\\Collection->updateEntryUris()
#10 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/Store.php(84): Statamic\\Stache\\Stores\\CollectionsStore->handleFileChanges()
#11 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Repositories/CollectionRepository.php(26): Statamic\\Stache\\Stores\\Store->getItems()
#12 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Repositories/CollectionRepository.php(58): Statamic\\Stache\\Repositories\\CollectionRepository->all()
#13 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/spatie/blink/src/Blink.php(279): Statamic\\Stache\\Repositories\\CollectionRepository->Statamic\\Stache\\Repositories\\{closure}()
#14 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Support/Blink.php(18): Spatie\\Blink\\Blink->once()
#15 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Statamic\\Support\\Blink->__call()
#16 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Repositories/CollectionRepository.php(59): Illuminate\\Support\\Facades\\Facade::__callStatic()
#17 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Statamic\\Stache\\Repositories\\CollectionRepository->handles()
#18 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/EntriesStore.php(18): Illuminate\\Support\\Facades\\Facade::__callStatic()
#19 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stores/AggregateStore.php(70): Statamic\\Stache\\Stores\\EntriesStore->discoverStores()
#20 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Collections/HigherOrderCollectionProxy.php(60): Statamic\\Stache\\Stores\\AggregateStore->clear()
#21 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(230): Illuminate\\Support\\HigherOrderCollectionProxy->Illuminate\\Support\\{closure}()
#22 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Collections/HigherOrderCollectionProxy.php(61): Illuminate\\Support\\Collection->each()
#23 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stache.php(82): Illuminate\\Support\\HigherOrderCollectionProxy->__call()
#24 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Stache/Stache.php(91): Statamic\\Stache\\Stache->clear()
#25 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Statamic\\Stache\\Stache->refresh()
#26 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/statamic/cms/src/Console/Commands/StacheRefresh.php(23): Illuminate\\Support\\Facades\\Facade::__callStatic()
#27 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Statamic\\Console\\Commands\\StacheRefresh->handle()
#28 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#29 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#30 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#31 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\\Container\\BoundMethod::call()
#32 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#33 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/symfony/console/Command/Command.php(258): Illuminate\\Console\\Command->execute()
#34 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#35 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/symfony/console/Application.php(920): Illuminate\\Console\\Command->run()
#36 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/symfony/console/Application.php(266): Symfony\\Component\\Console\\Application->doRunCommand()
#37 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/symfony/console/Application.php(142): Symfony\\Component\\Console\\Application->doRun()
#38 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#39 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#40 /home/ploi/staging.rewe-group.at-deploy/staging.rewe-group.at/30102020_095529/please(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#41 {main}
"}
Statamic 3.0.21 Pro
Laravel 8.11.2
PHP 7.4.11
aerni/zipper 1.2.0
I know it's not a permanent fix but you can replace the stache clear command with php artisan cache:clear. It'll clear the Laravel cache (and the Stache) without the stache error.
Ah sweet. Will try that. Did you run into this as well?
Yeah, I've ran into it in the past.
Your quick fix did it. php artisan cache:clear instead of php please stache:refresh.
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.
Most helpful comment
Your quick fix did it.
php artisan cache:clearinstead ofphp please stache:refresh.