genecommerce / module-encryption-key-manager

Tooling to help generate and invalidate magento encryption keys
GNU Lesser General Public License v3.0
54 stars 14 forks source link

Unable to retrieve deployment version of static files from the file system. #48

Closed nrdevau closed 1 month ago

nrdevau commented 1 month ago

I haven't seen anyone reference this. Title is the error I'm getting after

Replication Steps

  1. bin/magento maintenance:enable
  2. bin/magento gene:encryption-key-manager:generate (for real though)
  3. bin/magento maintenance:disable
  4. OH NO (glad this is staging!) - bin/magento cache:flush
  5. Error report page - var/report/xx/xxxxxxxxxxxxxxxxxxxxxxx

Stacktrace

UnexpectedValueException: Unable to retrieve deployment version of static files from the file system. in /app/hopefullystaging_path/vendor/magento/framework/App/View/Deployment/Version.php:88
Stack trace:
#0 /app/hopefullystaging_path/vendor/magento/framework/App/View/Deployment/Version.php(67): Magento\Framework\App\View\Deployment\Version->readValue()
#1 /app/hopefullystaging_path/vendor/magento/module-theme/Model/Url/Plugin/Signature.php(87): Magento\Framework\App\View\Deployment\Version->getValue()
#2 /app/hopefullystaging_path/vendor/magento/module-theme/Model/Url/Plugin/Signature.php(65): Magento\Theme\Model\Url\Plugin\Signature->renderUrlSignature()
#3 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Theme\Model\Url\Plugin\Signature->afterGetBaseUrl()
#4 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Store\Model\Store\Interceptor->Magento\Framework\Interception\{closure}()
#5 /app/hopefullystaging_path/generated/code/Magento/Store/Model/Store/Interceptor.php(23): Magento\Store\Model\Store\Interceptor->___callPlugins()
#6 /app/hopefullystaging_path/vendor/magento/framework/Url.php(484): Magento\Store\Model\Store\Interceptor->getBaseUrl()
#7 /app/hopefullystaging_path/vendor/magento/framework/View/Asset/Repository.php(289): Magento\Framework\Url->getBaseUrl()
#8 /app/hopefullystaging_path/vendor/magento/framework/View/Asset/Repository.php(238): Magento\Framework\View\Asset\Repository->getFallbackContext()
#9 /app/hopefullystaging_path/vendor/magento/framework/View/Page/Config.php(496): Magento\Framework\View\Asset\Repository->createAsset()
#10 /app/hopefullystaging_path/vendor/magento/framework/View/Page/Config/Generator/Head.php(132): Magento\Framework\View\Page\Config->addPageAsset()
#11 /app/hopefullystaging_path/vendor/magento/framework/View/Page/Config/Generator/Head.php(104): Magento\Framework\View\Page\Config\Generator\Head->processAssets()
#12 /app/hopefullystaging_path/vendor/magento/framework/View/Layout/GeneratorPool.php(93): Magento\Framework\View\Page\Config\Generator\Head->process()
#13 /app/hopefullystaging_path/vendor/magento/framework/View/Layout.php(365): Magento\Framework\View\Layout\GeneratorPool->process()
#14 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->generateElements()
#15 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent()
#16 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}()
#17 /app/hopefullystaging_path/generated/code/Magento/Framework/View/Layout/Interceptor.php(32): Magento\Framework\View\Layout\Interceptor->___callPlugins()
#18 /app/hopefullystaging_path/vendor/magento/framework/View/Layout/Builder.php(129): Magento\Framework\View\Layout\Interceptor->generateElements()
#19 /app/hopefullystaging_path/vendor/magento/framework/View/Page/Builder.php(65): Magento\Framework\View\Layout\Builder->generateLayoutBlocks()
#20 /app/hopefullystaging_path/vendor/magento/framework/View/Layout/Builder.php(65): Magento\Framework\View\Page\Builder->generateLayoutBlocks()
#21 /app/hopefullystaging_path/vendor/magento/framework/View/Layout.php(271): Magento\Framework\View\Layout\Builder->build()
#22 /app/hopefullystaging_path/vendor/magento/framework/View/Layout.php(896): Magento\Framework\View\Layout->build()
#23 /app/hopefullystaging_path/vendor/magento/module-cms/Helper/Page.php(216): Magento\Framework\View\Layout->getBlock()
#24 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Cms\Helper\Page->prepareResultPage()
#25 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Cms\Helper\Page\Interceptor->___callParent()
#26 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Helper\Page\Interceptor->Magento\Framework\Interception\{closure}()
#27 /app/hopefullystaging_path/generated/code/Magento/Cms/Helper/Page/Interceptor.php(23): Magento\Cms\Helper\Page\Interceptor->___callPlugins()
#28 /app/hopefullystaging_path/vendor/magento/module-cms/Controller/Index/Index.php(74): Magento\Cms\Helper\Page\Interceptor->prepareResultPage()
#29 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Cms\Controller\Index\Index->execute()
#30 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Cms\Controller\Index\Index\Interceptor->___callParent()
#31 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}()
#32 /app/hopefullystaging_path/generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(23): Magento\Cms\Controller\Index\Index\Interceptor->___callPlugins()
#33 /app/hopefullystaging_path/vendor/magento/framework/App/Action/Action.php(111): Magento\Cms\Controller\Index\Index\Interceptor->execute()
#34 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch()
#35 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Cms\Controller\Index\Index\Interceptor->___callParent()
#36 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}()
#37 /app/hopefullystaging_path/generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(32): Magento\Cms\Controller\Index\Index\Interceptor->___callPlugins()
#38 /app/hopefullystaging_path/vendor/magento/framework/App/FrontController.php(245): Magento\Cms\Controller\Index\Index\Interceptor->dispatch()
#39 /app/hopefullystaging_path/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#40 /app/hopefullystaging_path/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#41 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#42 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#43 /app/hopefullystaging_path/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(99): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#44 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch()
#45 /app/hopefullystaging_path/vendor/fastly/magento2/Model/FrontControllerPlugin.php(135): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#46 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(135): Fastly\Cdn\Model\FrontControllerPlugin->aroundDispatch()
#47 /app/hopefullystaging_path/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(71): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#48 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch()
#49 /app/hopefullystaging_path/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#50 /app/hopefullystaging_path/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#51 /app/hopefullystaging_path/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#52 /app/hopefullystaging_path/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#53 /app/hopefullystaging_path/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#54 {main}

Time to go digging

nrdevau commented 1 month ago

Interesting.. It seems to be related to dev/static/sign I'll try a static content redeploy, assuming this will leave media as is

nrdevau commented 1 month ago

bin/magento setup:static-content:deploy -f did the trick in my situation

convenient commented 1 month ago

Hello @nrdevau

This process should have done nothing to the env.php to change the deployment config dev/static/sign information or break the frontend. I'll verify with a test case.

nrdevau commented 1 month ago

I don't believe I changed that value at the same time, but something in my environment caused things to fall over, my guess is because that was turned on, and maybe others have only tried with it off? Or just not reported it? The test case will verify 😅

convenient commented 1 month ago

@nrdevau https://github.com/genecommerce/module-encryption-key-manager/pull/49

Everything seems fine to me, you can see with FPC disabled the tests have maintained access to version1721980920 so I suspect whatever else went on here, was something on your setup / system not specifically related to key invalidation.

It is hard as theres a lot of moving parts .

nrdevau commented 1 month ago

Yes, thanks for verifying. Must be something related to either

  1. Magento Cloud hosting OR
  2. The 50+ Custom built modules and 30+ 3rd party modules in the mix 👍

Hope this serves as a solution for someone else at some point. Who knows!

convenient commented 1 month ago

We generated all our keys on magento cloud and sonassi without issue 🤷

convenient commented 1 month ago

👋 I'm not 100% confident on the cause here, so i'm tweaking the readme.md from your PR and pulling in with other work here

https://github.com/genecommerce/module-encryption-key-manager/pull/55