I upgraded my Contao website from 4.13.38 to 5.3.1. Everything was successful, Contao Manager is working okay, but the website is not functioning. The error is logged in var/logs and points to a non-existent service "contao.image.image_sizes":
Uncaught PHP Exception SymfonyComponentDependencyInjectionExceptionServiceNotFoundException: "You have requested a non-existent service "contao.image.image_sizes". Did you mean one of these: "contao.image.imagine", "contao.image.imagine_svg", "contao.image.resizer", "contao.image.sizes"?" at Container.php line 263
{
"exception":
"[object] (SymfonyComponentDependencyInjectionExceptionServiceNotFoundException(code: 0): You have requested a non-existent service "contao.image.image_sizes". Did you mean one of these: "contao.image.imagine", "contao.image.imagine_svg", "contao.image.resizer", "contao.image.sizes"? at /opt/testportal/vendor/symfony/dependency-injection/Container.php:263)"
}
{
"request_uri": "https://testportal/contao/login",
"request_method": "GET"
}
Both FE and BE are not working.
What could be the problem here? I searched for solution in Internet, but although there were similar questions, I didn’t find real solution.
Beside contao-core bundles, there are rocksolidthemes (madeyourday) plugins installed and upgraded.
2
Answers
Solution
The problem was caused by theme I used. The theme files should be also actualized after the upgrade, but since the BackEnd is not working, it's not possible to do that by theme import, and files should be replaced manually over FTP.
In my case, it was Oneo theme and files that were using the wrong service are:
In each of these of files there is line
and in actualized version (for Contao 5.0 - 5.3) the line is changed to:
Alternative solution:
In folder config there should be added file services.yaml with following code:
This is the same configuration as it is for service contao.image.sizes in core-bundle, but for some reason the system is searching for contao.image.image_sizes. Since that service is not exists, we copied the definition under the name of missing service.
Somewhere I found this code, and there is probably why the system is searching for contao.image.image_sizes
When updating Contao you will also always need to update the theme, according to the theme vendor’s instructions – especially when updating to new minor or major versions. In your case you did not update the RockSolid Custom Elements config files of the Oneo theme for example for the new Contao version which resulted in this error.