magento2: Invalid header value in NewRelicReporting when flushing Magento cache
Preconditions (*)
- Magento 2.4.3
- Running on AWS behind Application Load Balancer.
Steps to reproduce (*)
- Enable built-in NewRelic reporting
- System -> Cache management -> Flush Magento cache.
Expected result (*)
Cache flushed.
Actual result (*)
Raw plain-text PHP error page with the following content:
1 exception(s):
Exception #0 (Zend_Http_Header_Exception_InvalidArgumentException): Invalid header value
Exception #0 (Zend_Http_Header_Exception_InvalidArgumentException): Invalid header value
<pre>#1 Zend_Http_Client->_validateHeaderValue() called at [vendor/magento/zendframework1/library/Zend/Http/Client.php:467]
#2 Zend_Http_Client->setHeaders() called at [vendor/magento/zendframework1/library/Zend/Http/Client.php:439]
#3 Zend_Http_Client->setHeaders() called at [vendor/magento/module-new-relic-reporting/Model/Apm/Deployments.php:75]
#4 Magento\NewRelicReporting\Model\Apm\Deployments->setDeployment() called at [vendor/magento/module-new-relic-reporting/Model/Observer/ReportSystemCacheFlushToNewRelic.php:62]
#5 Magento\NewRelicReporting\Model\Observer\ReportSystemCacheFlushToNewRelic->execute() called at [vendor/magento/framework/Event/Invoker/InvokerDefault.php:88]
#6 Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod() called at [vendor/magento/framework/Event/Invoker/InvokerDefault.php:74]
#7 Magento\Framework\Event\Invoker\InvokerDefault->dispatch() called at [vendor/magento/framework/Event/Manager.php:66]
#8 Magento\Framework\Event\Manager->dispatch() called at [generated/code/Magento/Framework/Event/Manager/Proxy.php:95]
#9 Magento\Framework\Event\Manager\Proxy->dispatch() called at [vendor/magento/module-backend/Controller/Adminhtml/Cache/FlushSystem.php:31]
#10 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#11 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#12 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#13 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->___callPlugins() called at [generated/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem/Interceptor.php:23]
#14 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#15 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:151]
#16 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#17 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#18 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143]
#19 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#20 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/mirasvit/module-rewards/src/RewardsCustomerAccount/Plugin/CustomerSessionContext.php:55]
#21 Mirasvit\RewardsCustomerAccount\Plugin\CustomerSessionContext->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#22 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#23 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->___callPlugins() called at [generated/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem/Interceptor.php:32]
#24 Magento\Backend\Controller\Adminhtml\Cache\FlushSystem\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:245]
#25 Magento\Framework\App\FrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212]
#26 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:147]
#27 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#28 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#29 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#30 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#31 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#32 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#33 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:29]
</pre>
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (2 by maintainers)
@speller
The problem for us was, when we set env variable with API key from AWS into the global scope, it is not encrypted in scope config. A New Relic config helper tries to decrypt it and we get non-valid hieroglyphic API key which throws an error when you send it as header with Zend Http. That is what’s going on in the stack trace.