Magento1.9 – Causes of Error Related to ‘dashboard/tunnel/key’

adminadminhtmldashboardmagento-1magento-1.9

There is below information in the log, but no idea what could cause this 🙁

a:5:{i:0;s:45:"Unable to read response, or response is empty";
i:1;s:1003:"#0 lib/Varien/Http/Client.php(61): Zend_Http_Client->request('GET')
#1 app/code/core/Mage/Adminhtml/controllers/DashboardController.php(100):
Varien_Http_Client->request('GET')
#2 app/code/core/Mage/Core/Controller/Varien/Action.php(418):
Mage_Adminhtml_DashboardController->tunnelAction()
#3 app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254):
Mage_Core_Controller_Varien_Action->dispatch('tunnel')
#4 app/code/core/Mage/Core/Controller/Varien/Front.php(172):
Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#5 app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#6 app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 index.php(83): Mage::run('my_store', 'store')
#8 {main}";
s:3:"url";s:543:"/index.php/admin/dashboard/tunnel/key/ba90f30f2af450c5980c4c6353c49d61/?ga=..&h=..";
s:11:"script_name";s:10:"/index.php";
s:4:"skin";s:5:"admin";}

Best Answer

The tunnel action is the action that retrieves the chart data on the dashboard.

As you may know the dashboard chart are generated by Google Chart Api.

As you can see from the method, the tunnel action calls the API URL to generate the chart:

public function tunnelAction()
{
    $httpClient = new Varien_Http_Client();
    $gaData = $this->getRequest()->getParam('ga');
    $gaHash = $this->getRequest()->getParam('h');
    if ($gaData && $gaHash) {
        $newHash = Mage::helper('adminhtml/dashboard_data')->getChartDataHash($gaData);
        if ($newHash == $gaHash) {
            $params = json_decode(base64_decode(urldecode($gaData)), true);
            if ($params) {
                $response = $httpClient->setUri(Mage_Adminhtml_Block_Dashboard_Graph::API_URL)
                        ->setParameterGet($params)
                        ->setConfig(array('timeout' => 5))
                        ->request('GET');

                $headers = $response->getHeaders();

                $this->getResponse()
                    ->setHeader('Content-type', $headers['Content-type'])
                    ->setBody($response->getBody());
            }
        }
    }
}

With:

const API_URL = 'http://chart.apis.google.com/chart';

The problem could be that your store is behing a proxy and thus it cannot retrieve the Google Chart API URL data.

Related Topic