Problem/Motivation
Pages are not showing up (WSOD) with the following error:
The website encountered an unexpected error. Please try again later.
InvalidArgumentException: Cannot redirect to an empty URL. in Symfony\Component\HttpFoundation\RedirectResponse->setTargetUrl() (line 86 of vendor/symfony/http-foundation/RedirectResponse.php).
I also noticed that the LOGO and HOME in the main menu do not redirect to the front page but instead they redirect to the current page.
Steps to reproduce
- Create a duplicate of the Content view
- Edit the duplicate
- Change the path to say /break
- Got to admin/structure/views and see that the path for the duplicate view is "/" not "/break"
- Log out and get The website encountered an unexpected error. Please try again later.
Workaround
Log back in, delete the duplicate view, and logout works without error.
Proposed resolution
TBD
Remaining tasks
Add a test
Patch
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
cilefen commentedCould you try to isolate the steps to reproduce? Can you get the full backtrace?
Comment #3
dqdI can confirm the behaviour humbled over with testing enviroment of Drupal 8.5.4 local under php 7.2 and a little bit larger module stack and prject set to dev-stage via drupal console today. We need more info here since the chance is there, that another project instead of core comes here into the mix (redirect?).
It would be helpful if @tepelena could report some more details about the install and the last steps made before the issue occured. In our case it is hard to say, since we had 3 testers working on it and the issue occured over night in the next morning. No way out.
We have to tackle it down here further to report more but I can at least say, in the moment when you choose another path like /admin etc. the issue disappears. It only breaks on frontpage again. And yes, the home path is always the path your in at the moment. Let me test around with some Views path overrides (disabling) and the frontpage setting to see what happens.
Comment #4
dqdOK, I think we have a possible starting point to discuss here. It seems this issue can occur in several ways, all pointing back to the fact that Drupal 8 relies now strongly on Views and views paths. Other modules possibly override this, or for some reason it is required to disable the default frontpage view to make other modules work correctly. In this case the default frontpage is broken and Drupal has no real good fall back in case if required and every path where you at in this moment becomes when something is broken. That's why home is unlinked in the breadcrumb and that's why clicking any home returns to the page where you are, which is a quite strange foallback behaviour, IMHO (How the issue poster has reported)
Many users will asume that D8 works in this case like D7, where /node is always the fallback if any alternative frontpage settings gets broken or set off. For search ranking the Drupal 8 way is much better. Drupal 7 maintainers had a lot work to do to get rid of all the unaliased paths and /node if that's not the frontpage. But we possibly missed to integrate some "this should not break then" scenario. Not sure.
Comment #5
tepelena commentedThanks for the reply. This was a problem on our end. A view that was not configured properly and also ened up with the path:/ was causing the problem.
Comment #6
dqd@tepelena: thanks for taking the time to report back. It shows another example of that my concerns regarding Views path fall backs and handling are possibly not unreasoned. In this case it brings even one more question on top: what if Views paths override each other or are internal /? In the menu system we have checks against exisitng or not existing links, allowed and not allowed paths. This issue requires maybe some discussion (not sure) when free time is available, so let's keep it active.
On this regard I edited and typo corrected a little bit of the issue summary, if you don't mind, @tepelena.
Apart from that after all new informations, we can set the alert level one step more down since this is even not a "Major" from what I see here now. It is rather a question about if we want to implement alternatives checks instead of Exception errors here.
Comment #7
mattferderer commentedRan into this issue as well on a site. Something is killing my URL.
A default fallback & warning message would be preferred over the error message in my opinion.
Comment #9
micahw156Yesterday, I added a new display to an existing view, then set the original display to be the default tab, but didn't change its URL. In initial testing, I'm pretty sure I could display and switch between tabs as expected, but I'm not 100% sure I actually tested that. Somehow the path for the initial tab was showing up as / in the views listing, rather than the path set in the view, and all attempts to access the site's homepage resulted in the error shown above, and links to HOME, etc, were indeed pointing back to the current page instead.
I think something like that might help to reproduce this in the future.
Comment #11
makbay commentedI can confirm the case at #9 reproduces this bug. Also clicking the site logo does not go to home page and language switcher flag icons stop working on home page in this case.
Comment #12
alienzed commentedWow, just encountered this. Creating or editing a new view should not be able to kill a site's homepage...
Comment #13
emilie.viau commentedI had the same error on log out (InvalidArgumentException), plus homepage link problems. My home link was not showing up for log out people despite it has no permission limitation. I came accross the problem by doing this :
/admin/config/development/configuration/single/exportand export the Frontpage view configurationadmin/config/development/configuration/single/importand paste the configurationAfter that, all came back to normal for me.
Comment #14
Yuri commented#5 was caused my same issue too. Thanks!
Comment #15
jini osaka commented@emilie.viau thanks for posting you soluition #13
I tried it but after import got the message: "There are no changes to import."
Comment #17
drakythe commentedJust had this happen to one of our clients. #5 was the answer for us.
We duplicated a view that had its path at `/some-path/view` and its menu settings set to Default Menu Tab with the Parent Tab set to respond at the standard `/some-path`. When we duplicated that view my team member just set a page path and changed nothing about the menu setting, only his page path was `/some-other-path`. The view kept that path, but in the View Overview list the path was displaying as `/`. We Duplicated the view page as a Block, deleted the bad page and saved the view. Everything returned to normal.
Comment #19
bmateus commentedI've just updated to 8.9.1, and this issue started. It now seems impossible for Drupal to accept a custom "front-page", and I have all the behaviour listed in #9.
Every path that we insert as a default frontpage stops working, gives WSOD.
Another issue that could be related:
I'm using some graphql views, and image urls that contain a token(itok) are now transforming the query's '&' character to '&'. This was not the behaviour before.
On direct graphql queries all remains as it was.
Updated:
I've also found I'm unable to export full configuration, blows to WSOD. Nothing appears on Drupal logs.
On my servers log, I get
(70007)The timeout specified has expired: AH01075: Error dispatching request to :, referer: https://[domain]/en/admin/config/development/configuration/full/exportAny ideas if this may be linked?
The export issue had nothing to do with it. Just needed to increase the php timeout from 60 seconds to about 200.
The other issues continue, though.
Comment #20
Mzambrana commentedI experience the same error with a Drupal that I installed the Redirect module and because of a view that had the path / homepage it did not load.
Disable the view and everything worked correctly again.
Thank you very much for the help, greetings.
Comment #21
cgmonroe commentedWe had the same problem. I have found how to reproduce the error but not the full effect of always getting it for the home page.
First, create a new drupal instance on simplytest.me. No modules needed.
Create a basic page to use as a node homepage.
Set the home page to that node. (Basic Settings)
Go the Structure Views.
Edit the Content view.
Duplicate the existing view.
In the path setting, ONLY CHANGE the path to /break-it (or anything that is one level).
Save.
Go back to the view listing and you should see that the subview you created is listed as using / for a path.
Log out and you will get an Error page with the Cannot redirect message in the log.
NOTE: Strangely, if you change the URL to just / ... the original homepage will come back. But the error will happen on each logout which should let people start to debug it.
Comment #23
lissy commentedI get the same error with a windows installation and with Linux at the hoster:
But logout works.
Error eccurs if i make a dublication of Admin content view:
/admin/structure/views/view/content/edit/page_1 to /admin/structure/views/view/content/edit/page_2 with al littel change.
If i delete the second page, logout works
Comment #24
andresisvworld commentedI had the same issue as Lissy. I duplicated the People view to have a list of users and users that didn't have the permissions to see what is in the view were unable to access the page.
Comment #28
quietone commentedI just encountered this on Drupal 9.3.something which I then updated to 9.4.2 and the problem persisted. Adding steps to reproduce, which are very similar to #21. My experience and the comments all point to this being a Views issue, therefore changing component.
Comment #30
le72Had exactly the same thing today, Drupal 9.5.5.
Comment #31
ruuds commentedI had the same issue on 9.5.8. A view had two page displays with different urls:
/dashboard-my-applicationsis presented as/in the views overview, but seemed to be correctly configured when editing the view. As these page displays were completely identical, removing the first one solved the issue for me.Comment #33
lthomasen commentedUsing Drupal 9.5.11, I had the issue with WSOD when logging out. Log message said:
When looking inside the view that caused the problem, the paths were correct, but from the /admin/structure/views page, one of the displays in my view was listed as Page (/).
The reason the problem was created in the first place, was probably that I had messed to much with creating menu tabs in my view. Saving all page paths in the view displays as "Normal menu entry" finally cleared the missing path.
Comment #34
handkerchiefSame issue for me as with #33: https://www.drupal.org/project/redirect/issues/3447718#comment-15736214
Comment #35
ressaThanks for linking to this issue @handkerchief from #3447718: Cannot redirect to an empty URL, and @lthomasen sharing your scenario.
I also ran into this after updating Menu settings in a View, in the process of not using Tabs with a "Parent menu link", after letting go of the difficult menu tab set up.
The only way I could access the front page was disabling "Global redirects" > "Enforce clean and canonical URLs" in the Redirect module.
After changing to a standard "Normal menu entry" in the View, all is well again, and I can again enforce clean and canonical URLs with the Redirect module.
Comment #36
mortona2k commentedI ran into the same as above, caused bad views tabs config.