Error 500 Message: [{"container":{}},"getNotification"] is not resolvable

Hi, I am new on Slime.
Work on API project. Everything good until I have to add a new endpoint (new method too) and I got this Error for my new endpoint, another endpoint run well. Below is error log:

Details

Type: RuntimeException
Message: [{"container":{}},"getNotification"] is not resolvable
File: /opt/myanime/api/vendor/slim/slim/Slim/CallableResolver.php
Line: 104

Trace

#0 /opt/myanime/api/vendor/slim/slim/Slim/CallableResolver.php(62): Slim\CallableResolver->assertCallable(Array)
#1 /opt/myanime/api/vendor/slim/slim/Slim/CallableResolverAwareTrait.php(45): Slim\CallableResolver->resolve('UserController:...')
#2 /opt/myanime/api/vendor/slim/slim/Slim/Route.php(333): Slim\Routable->resolveCallable('UserController:...')
#3 /opt/myanime/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(122): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#4 /opt/myanime/api/vendor/slim/slim/Slim/Route.php(316): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#5 /opt/myanime/api/vendor/slim/slim/Slim/App.php(476): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
#6 /opt/myanime/api/src/MyanimeMiddleware.php(121): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#7 [internal function]: App\MyanimeMiddleware->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
#8 /opt/myanime/api/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(App\VestiaMiddleware), Array)
#9 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
#10 /opt/myanime/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(73): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
#11 /opt/myanime/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(122): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#12 /opt/myanime/api/vendor/slim/slim/Slim/App.php(370): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#13 /opt/myanime/api/vendor/slim/slim/Slim/App.php(295): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#14 /opt/myanime/api/public/index.php(35): Slim\App->run()
#15 {main}

My routes:

$app->get('/user/notification', 'UserController:getNotification');

My class:

class UserController{
    public function __construct($container)
	{
			// make the container available in the class
			$this->container = $container;
	}

    public function getNotification($request, $response, $args){
			//some code here
    }
}

tried to composer dump-autoload but that did not work. please help.

What does your container entry look like? Or are you letting Slim instantiate the class?

Hi @tflight, I am used dependencies for my container entry on dependencies.php. below is the code on my dependencies.php:

 use App\Controllers\UserController;
 $container = $app->getContainer();
 $container['UserController'] = function ($c) {
	return new UserController($c);
 };

Change:

to:

$app->get('/user/notification', 'App\Controllers\UserController:getNotification');

Hi Akrabat, thanks for your response. I already did it and still got the same error. In my case, this error only appears on the new API with method getNotification. another API that has the method in the same controller (UserController) I created before run well.