Unable to generate a URL for the named route “metrics_page” as such route does not exist.

Unable to generate a URL for the named route “metrics_page” as such route does not exist.

500 Internal Server Error on PrestaShop admin login:

image 23 - Unable to generate a URL for the named route "metrics_page" as such route does not exist.
image 24 1024x193 - Unable to generate a URL for the named route "metrics_page" as such route does not exist.

The first step when troubleshooting any application is to check the error logs, in my case all logs are empty, so the next step is to enable debug mode in prestashop:

Open config/defines.inc.php

image 27 - Unable to generate a URL for the named route "metrics_page" as such route does not exist.

On line 28, you will find this line: define(‘_PS_MODE_DEV_’, false); – replace it with:

define('_PS_MODE_DEV_', true);
image 26 - Unable to generate a URL for the named route "metrics_page" as such route does not exist.

Then go back to the page that was displaying 500 error:

image 25 1024x517 - Unable to generate a URL for the named route "metrics_page" as such route does not exist.

In my case the problem Is causing metrics_page route, so the first thing to do is to temporarily disable it.

To disable a module from the database navigate to PHPMyAdmin and inside the ps_tab table for ps_metrics change the 1 to 0.

image 28 1024x676 - Unable to generate a URL for the named route "metrics_page" as such route does not exist.

To disable a module from the file manager, navigate to modules directory and rename the module name: ps_metrics

image 29 - Unable to generate a URL for the named route "metrics_page" as such route does not exist.

Then clear the cache by deleting/renaming the folders var/cache folder:

image 30 - Unable to generate a URL for the named route "metrics_page" as such route does not exist.

I can now access the admin section after deactivating the module that was generating the problem.

Why is the root-cause of the error?

I’ve seen a lot of other PrestaShop users talking about the same issues on forums, but the root cause is well explained here: HOW TO PREVENT ISSUES OF PRESTASHOP METRICS MODULE WHEN UPGRADING TO PRESTASHOP 1.7

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.