Laravel InvalidArgumentException in RouteRegistrar.php line 75:

Lloyd picture Lloyd · Feb 27, 2017 · Viewed 7.1k times · Source

I keep getting this error when trying to deploy a laravel application to a production server:

InvalidArgumentException in RouteRegistrar.php line 75:

in RouteRegistrar.php line 75
at RouteRegistrar->attribute('after', object(AfterFilter)) in Router.php line 1085
at Router->__call('after', array(object(AfterFilter))) in BootProviders.php line 17
at Router->after(object(AfterFilter)) in BootProviders.php line 17
at Application->boot() in BootProviders.php line 17
at BootProviders->bootstrap(object(Application)) in Application.php line 208
at Application->bootstrapWith(array('Illuminate\\Foundation\\Bootstrap\\LoadEnvironmentVariables', 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions', 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades', 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders', 'Illuminate\\Foundation\\Bootstrap\\BootProviders')) in Kernel.php line 160
at Kernel->bootstrap() in Kernel.php line 144
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 54

The strange thing is that I do not get this error on my local machine. The PHP version of my machine and the production server is nearly identical (5.6.25 on the server and 5.6.26 on my machine).

Does anyone have any idea what could be causing this error?

Answer

PeterPan666 picture PeterPan666 · Feb 27, 2017

This exception should throw a message like Attribute [{$key}] does not exist., you need to find this key and fix it. It seems that you are not using a correct key name, you can find the allowed ones here.

protected $allowedAttributes = [
    'as', 'domain', 'middleware', 'name', 'namespace', 'prefix',
];

The method that throws this exception is the attribute in the RouteRegistrar.php file.