I'm trying to set up an extant Symfony project on my local machine.
I made it far enough to get the project running, but when I browse to any of the routes in the router, I get this error:
No route found for "GET /users/"
404 Not Found - NotFoundHttpException
1 linked Exception:
ResourceNotFoundException »
DEBUG - Notified event "kernel.request" to listener "Nelmio\CorsBundle\EventListener\CorsListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelException".
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ExceptionListener::onKernelException".
ERROR - Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /"" at /Users/james/code/REDACTED/REDACTED/app/cache/dev/classes.php line 1880
When I $ php console router:debug
I get dozens of routes, including the /users/ routes:
intranet_users ANY ANY {domain} /users/
intranet_user_create ANY ANY {domain} /users/create
intranet_user ANY ANY {domain} /users/{username}
What gives? Why does every route I browse to on localhost:8000 result in a Symfony error page?
After speaking with the project lead dev, I was told I need to set the project up with a Docker container rather than in my local environment.
I think the reason I wasn't getting routing to work is that the domain I was hosting on locally didn't match the expected {domain} from the router config file. I was trying to access via localhost
while the expected domain was intranet.localhost
.
Coming from a Rails background, I wasn't used to routing being so picky with domains.