Open Lozik opened 4 years ago
The server simply returns a 404, no profiler, no kernel request, no logging, nothing.
Do you setup the routes as described in https://symfony.com/doc/master/bundles/FOSJsRoutingBundle/installation.html#step-3-register-the-routes ? In which environment ?
And how do you know that this request returns 404? What is the full url?
Yes, I set them up exactly as described in your referenced document.
I can tell that it returns 404 because if I'm debugging using PANTHER_NO_HEADLESS, the browser has an error in its console. If the 404 path is manually opened, it shows the following message:
Whereas, if I'm navigating to another page that does not exist (not having the /js
prefix), the following is shown:
Another way I can tell is that in the /var/log/test.log
, no entry NotFoundHttpException: No route found for
is present for the first call but it is for the second call (second screenshot).
As a fix, I locally changed the path of FOSRouting to /js-routing
instead of /js/routing
in the vendor folder. However thats not an acceptable fix - especially for CI.
IMHO, this must be a bug of panther.
What you see in "normal browser" (chrome / firefox in your OS - not panther) when you browse that url /js/routing?callback=fos.Router.setData
?
Also what are the contents of public/js
dir?
If I open it in dev or prod in a normal browser, I get the content correctly, i.e. json data /**/fos.Router.setData({"base_url":"","routes":...
.
I've got other files in public/js
like other .js files, subfolders etc. But no other file or folder starting with the word routing
.
Faced the exact same issue with a route ending in .json (quicklist.json
), removing the .json
from the route name got it working.
I noticed that I couldn't get the
friendsofsymfony/jsrouting-bundle
working with panther. Using the symfony WebTestCase, it worked, but not with panther.The route of one specific JSRouting page is
/js/routing?...
. As the folder/js
exists in the/public
folder, the page has not been found. The symfony kernel is not even started for that request. The server simply returns a 404, no profiler, no kernel request, no logging, nothing. However, if one manually changes the route from that jsrouting bundle to something like/js-routing
, then the browser opened by panther can open that page and everything works like a charm. However changing the route of a vendor package is not the thing to do. I hope, this is an easy fix.