-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I've upgraded from version 0.6 to version 0.7 and started to get the error below after some time using it:
#0 [internal function]: Dingo\Api\Http\Filter\RateLimitFilter->filter(Object(Dingo\Api\Routing\Route), Object(Illuminate\Http\Request))
#1 /var/www/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(323): call_user_func_array(Array, Array)
#2 [internal function]: Illuminate\Events\Dispatcher->Illuminate\Events{closure}(Object(Dingo\Api\Routing\Route), Object(Illuminate\Http\Request))
#3 /var/www/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#4 /var/www/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#5 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1470): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#6 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1432): Illuminate\Routing\Router->callRouteFilter('api.throttle', Array, Object(Dingo\Api\Routing\Route), Object(Illuminate\Http\Request))
#7 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1319): Illuminate\Routing\Router->callAttachedBefores(Object(Dingo\Api\Routing\Route), Object(Illuminate\Http\Request))
#8 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1024): Illuminate\Routing\Router->callRouteBefore(Object(Dingo\Api\Routing\Route), Object(Illuminate\Http\Request))
#9 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#10 /var/www/vendor/dingo/api/src/Routing/Router.php(198): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#11 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): Dingo\Api\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#12 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(746): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#13 /var/www/vendor/barryvdh/laravel-debugbar/src/Middleware.php(33): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#14 /var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Barryvdh\Debugbar\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#15 /var/www/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /var/www/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(642): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /var/www/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
So I discovered that the old API limiting options became invalid on version 0.7. After publishing the new configuration file, I removed the throtlling key from the configuration array and realized that it wasn't disabled. So maybe I misunderstood the docs, that states: "To disable rate limiting simply remove all the throttles from the configuration file" .
The correct way to disable rate limiting is to keep the throttling option as an empty array (which is not by default), so the package is not backward compatible in this way.
Also it doesn't make sense to me that the Throttle class default options are ['limit' => 60, 'expires' => 60]. Why 60 request per hour?