bobdenotter / sitemap

Provide a sitemap (.xml) for your Bolt 4 site
MIT License
5 stars 4 forks source link

request.CRITICAL: Uncaught PHP Exception InvalidArgumentException #9

Closed starkdg closed 2 years ago

starkdg commented 2 years ago

Updated to Bolt 5 and I get an error when calling /sitemap.xml.

Here's the Error:

request.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The controller for URI "/sitemap.xml" is not callable: Controller "Bobdenotter\Sitemap\Controller" has required constructor arguments and does not exist in the container. Did you forget to define the controller as a service?" at /var/www/vendor/symfony/http-kernel/Controller/ControllerResolver.php line 88 {"exception":"[object] (InvalidArgumentException(code: 0): The controller for URI \"/sitemap.xml\" is not callable: Controller \"Bobdenotter\Sitemap\Controller\" has required constructor arguments and does not exist in the container. Did you forget to define the controller as a service? at /var/www/vendor/symfony/http-kernel/Controller/ControllerResolver.php:88)\n[previous exception] [object] (InvalidArgumentException(code: 0): Controller \"Bobdenotter\Sitemap\Controller\" has required constructor arguments and does not exist in the container. Did you forget to define the controller as a service? at /var/www/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php:64)\n[previous exception] [object] (ArgumentCountError(code: 0): Too few arguments to function Bobdenotter\Sitemap\Controller::__construct(), 0 passed in /var/www/vendor/symfony/http-kernel/Controller/ControllerResolver.php on line 147 and exactly 1 expected at /var/www/vendor/bobdenotter/sitemap/src/Controller.php:16)"} []

Is Controller defined as a service? How do I do that?

thanks dgs.

xiaohutai commented 2 years ago

Hi @starkdg,

Can you try updating and see if it works again. It looks like sometimes it gets a bit stuck with auto-loading stuff, but not sure what is causing it. Since this is an older issue, I'll be closing it now. If you still get issues, feel free to open a new issue.

Kind regards!

nicohery commented 11 months ago

I got the same error on the first call. Don't forget to clear the cache. This solved the problem in my case.