AttributeError: 'NoneType' object has no attribute 'list_middleware' in masonite\routes\Route.py", line 166

150 Views Asked by At

Upon running python craft migration create_a_table --create a_table I received the following traceback:

Traceback (most recent call last):
  File "SOMEPATH\craft", line 8, in <module>
    from wsgi import application
  File "SOMEPATH\wsgi.py", line 11, in <module>
    application.register_providers(Kernel, ApplicationKernel)
  File "SOMEPATH\venv\lib\site-packages\masonite\foundation\Application.py", line 32, in register_providers
    provider.register()
  File "SOMEPATH\Kernel.py", line 29, in register
    self.register_routes()
  File "SOMEPATH\Kernel.py", line 72, in register_routes
    Route.group(
  File "SOMEPATH\venv\lib\site-packages\masonite\routes\Route.py", line 166, in group
    middleware = route.list_middleware
AttributeError: 'NoneType' object has no attribute 'list_middleware'

I've had a check with the debugger and for some reason it seems that the routes don't get loaded from the routes/web.py file is there something I am missing here

1

There are 1 best solutions below

0
On BEST ANSWER

It turns out that one of the dependencies I had somewhere had a missing dependency. I found out that the load function called in Kernel.register_routes silenced a ModuleNotFoundError. For some reason this error didn't get silenced in a fresh project that also was missing a dependency of a module. I am guessing that it is something to do with the configuration I have on this project.

For someone else that also has this error, using a debugger, set a breakpoint in masonite\utils\structures.py in the load function after except Exception as e: and you can read out the exception message to see what module is missing