lumen-framework: NotFoundHttpException in RoutesRequests.php line 461 right after installation

Hi,

I am not sure if everyone encounters this problem, but right after I created Lumen project 5.3, and set the key in .env file. I got this error without doing anything yet.

    NotFoundHttpException in RoutesRequests.php line 461:

    in RoutesRequests.php line 461
    at Application->handleDispatcherResponse(array('0')) in RoutesRequests.php line 399
    at Application->Laravel\Lumen\Concerns\{closure}() in RoutesRequests.php line 650
    at Application->sendThroughPipeline(array(), object(Closure)) in RoutesRequests.php line 400
    at Application->dispatch(null) in RoutesRequests.php line 341
    at Application->run() in index.php line 28

I googled the problem, there is a workaround by editing the file index.php and change it to this:

$app->run($app->make('request'));

After that work around, I was able to get the example up and running:

Lumen (5.3.1) (Laravel Components 5.3.*)

But for global middleware or route middleware, $request does not contain any input parameters as specified in routes.php, retrieve input always return NULL and it fails miserably.

Can somebody let me know what is the correct way to configure this Lumen? The full Laravel framework works flawlessly but its cousin does work as expected and it failed right after install.

Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 17 (3 by maintainers)

Most upvoted comments

@indiraJeldi how did you served the lumen application, did you used a command like php -S localhost:port -t public?

@hayjay , It just worked for me, by doing this two changes, I didnt use the command

  1. In routes.php replaced $app->post(‘createuser’, ‘UserController@create’); to $app->post(‘/createuser’, ‘UserController@create’);
  2. In public/index.php replaced $app->run() with $request = Illuminate\Http\Request::capture(); $app->run($request);

I have solved the problem. Look its your routes/web.php

$router->get('user','userController@index');
$router->get('user/{id}','userController@getuser');      
$router->post('user','userController@createuser');
$router->post('user/{id}','userController@updateuser');    
$router->delete('user/{id}','userController@deleteuser');

So you have to use this cmd when you start server php -S localhost:8000 -t public

and after that you can use postman or browser for check. I have given the url for get all the users.

localhost:8000/user