Closed farshadff closed 5 years ago
Hi
The group prefix v1 is completely redundant, and it makes your routes be under /v1/v1/, which doesn't make sense. Remove that whole group, and it should work.
I've updated the lib and now it raises an error:
{
"message": "The version given was unknown or has no registered routes.",
"status_code": 400,
"debug": {
"line": 79,
"file": "/var/www/html/app/vendor/dingo/api/src/Routing/Adapter/Laravel.php",
"class": "Dingo\\Api\\Exception\\UnknownVersionException",
"trace": [
"#0 /var/www/html/app/vendor/dingo/api/src/Routing/Router.php(514): Dingo\\Api\\Routing\\Adapter\\Laravel->dispatch(Object(Dingo\\Api\\Http\\Request), 'v1')",
"#1 /var/www/html/app/vendor/dingo/api/src/Http/Middleware/Request.php(126): Dingo\\Api\\Routing\\Router->dispatch(Object(Dingo\\Api\\Http\\Request))",
"#2 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Dingo\\Api\\Http\\Middleware\\Request->Dingo\\Api\\Http\\Middleware\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#3 /var/www/html/app/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#4 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#5 /var/www/html/app/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#6 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Fideloper\\Proxy\\TrustProxies->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#7 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#8 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#9 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#10 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#11 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#12 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#13 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#14 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#15 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#16 /var/www/html/app/vendor/dingo/api/src/Http/Middleware/Request.php(127): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
"#17 /var/www/html/app/vendor/dingo/api/src/Http/Middleware/Request.php(103): Dingo\\Api\\Http\\Middleware\\Request->sendRequestThroughRouter(Object(Dingo\\Api\\Http\\Request))",
"#18 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Dingo\\Api\\Http\\Middleware\\Request->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#19 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
"#20 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
"#21 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
"#22 /var/www/html/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))",
"#23 /var/www/html/app/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))",
"#24 {main}"
]
}
}
My route:
$api->version('v1', function ($api) {
$api->get('test', 'Test@index');
});
It seems to me it's not loading the api versions:
$ php artisan api:routes
Your application doesn't have any routes.
I am getting the same error after upgrading from v2.0.0-alpha2 to v2.2.3.
Edit: after running php artisan route:clear
the error seems to be resolved
Works for me!! Thx!!
php artisan route:clear
its work for me, thank you so much
@1giba @cacing69 @octfx thank for solution, but it is not a fix, is it ? 😁
We are in 2021, but I have same error and the only solution I've managed to find, is to not use the commands:
route:cache
api:cache
optimize
Maybe this issue should be re-opened? :/
Laravel 7.30.4 PHP 7.2.8 Dingo 3.0.5
same problems here Laravel 5.8.35 PHP 7.4 Dingo 2.4.7
@gadnis You can override optimize
command, changing route:cache
by api:cache
.
i have a project that i wana use dingo on it i just did all the documentation said and yet i get this error in below :
here is a part of my api.php route
Any one With similar problem ???