How I Fixed: “Authentication request could not be processed due to a system problem. “

Sometimes the simple stuff seems the hardest.

In my case I am working through the Symfony 4 update to the Symfony Deployment course and somewhat unusually, am not doing anything in dev, but lots of stuff in prod.

The reason for this is that I have forked the official Symfony demo project, and have slightly modified it for my needs. As it’s an official demo project, it’s pretty much guaranteed to work.

I had a production server set up, and had deployed my code.

I’d set up my environment variables – I believed, correctly. But when I hit the site:

“Authentication request could not be processed due to a system problem.”

I do enjoy a good error message.

The fix was simple in my case. I had set the wrong path to the database:

DATABASE_URL=mysql://dbuser:dbpassword@127.0.0.1:3306/db_dev

And what it should have been:

DATABASE_URL=mysql://dbuser:dbpassword@127.0.0.1:3306/dev_db

The db name was back to front.

In prod, the log files give no help around this, at all.

I had to spin up the dev environment where things are a lot more evident:

[2018-01-12 12:50:22] request.INFO: Matched route "security_login". {"route":"security_login","route_parameters":{"_controller":"App\\Controller\\SecurityController::login","_locale":"en","_route":"security_login"},"request_uri":"http://127.0.0.1:8000/en/login","method":"POST"} []
[2018-01-12 12:50:22] security.INFO: Authentication request failed. {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationServiceException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [1044] Access denied for user 'dbuser'@'%' to database 'dev_db' at /tmp/symfony-4-demo-app/vendor/symfony/security/Core/Authentication/Provider/DaoAuthenticationProvider.php:85, Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [1044] Access denied for user 'dbuser'@'%' to database 'dev_db' at /tmp/symfony-4-demo-app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:108, Doctrine\\DBAL\\Driver\\PDOException(code: 1044): SQLSTATE[HY000] [1044] Access denied for user 'dbuser'@'%' to database 'dev_db' at /tmp/symfony-4-demo-app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47, PDOException(code: 1044): SQLSTATE[HY000] [1044] Access denied for user 'dbuser'@'%' to database 'dev_db' at /tmp/symfony-4-demo-app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43)"} []
[2018-01-12 12:50:22] security.DEBUG: Authentication failure, redirect triggered. {"failure_path":"security_login"} []
[2018-01-12 12:50:22] request.INFO: Matched route "security_login". {"route":"security_login","route_parameters":{"_contr

The give away line being:

Access denied for user 'dbuser'@'%' to database 'dev_db'

Typos, such fun.

Anyway, easier to fix than it might otherwise appear. Hopefully it is for you, too.