We are hosting a very large enterprise installation of Piwik and we just did a test update from 1.12 to 2.6.1. Everything works so far, except that the site Settings => All Websites doesn’t show any websites although I’m logged in as super user:
[attachment 1922 screenshot.png]
I tried to debug this issue. The problem is that this request doesn’t give any results:
These are the request details (from Chrome dev tools):
[attachment 1924 screenshot2.png]
I set a log statement to SitesManager\API.php in the method getSitesWithAdminAccess and it retrieves the correct sites (all of them because I’m superuser):
public function getSitesWithAdminAccess($fetchAliasUrls = false)
$sitesId = $this->getSitesIdWithAdminAccess();
$sites = $this->getSitesFromIds($sitesId);
foreach ($sites as &$site)
$site['alias_urls'] = API::getInstance()->getSiteUrlsFromId($site['idsite']);
// here, $sites is a huge array with more than 1000 sites
However, the request doesn’t get any JSON response ( Content-Length:0 ). The strange thing is that I can make this request if I set the format parameter to “XML” instead of “JSON2”. It works when I just put it in the browser address bar, so it doesn’t even care if it’s a GET request instead of a POST. As soon as I set format=JSON2, it doesn’t work again.
I just updated to Piwik 2.7 and the problem still exists. There is nothing shown in the IIS error log. The request get a 200 OK anyway. The response is just empty. Any ideas where I can look in the source code? I really have no clue at the moment.
Interesting! This means it’s not something we did wrong in our environment, but it’s probably kind of a problem in Piwik. I hope someone can help soon because this is really a serious problem that keeps us from updating…
Thank you for your help - really appreciated! As I stated earlier, there is nothing printed in the IIS error log. Also, it’s a 200 OK response, so it doesn’t look like anything could be wrong from a webserver perspective.
[li] When the Ajax request from the Piwik Admin => All websites interface is sent, the response is emtpy, Content-Length:0
[/li]Content-Type:application/json; charset=utf-8. The token_auth parameter is the only one sent as “Form Data”
[li] When I type this URL in the browser, the response is empty, Content-Length:0
[li] When I use format=JSON instead of JSON2, the result is exactly the same
[/li][li] When I use format=XML in the browser bar, the result is the correct (very big) XML result
[/li][li] When I omit the token_auth parameter, the result is an empty JSON array, Content-Length:2
The strange thing is that the response won’t be empty for users that have only a few sites with admin permissions. I get the feeling that this is somehow related to the JSON size. But webserver-wise, everything’s ok, so probably this happens somewhere in the application layer. I will dig in some more now.
Actually I observed this interesting behavior now:
[li] When I remove the superuser setting from my user, it still doesn’t work
[/li][li] When I set all permissions on my user to “view”, I get an empty JSON array
[/li][li] When I set the first 100 sites on my user to “admin”, I get the correct JSON for the 100 sites
[/li][li] With 350 sites, it still works, the response content-length is 157788
[/li][li] With 400 sites, the response is empty again
I’m really curious now whether the problem occurs on IIS-side or Piwik-side…
I finally found the source of the problem! The response is empty if any site in the piwik_site table has an umlaut in its name. In my case, some pages had “ä”, “ü”, “ö” (German) in its name. As soon as I replaced all the umlauts, I got the correct JSON response. Note that the umlauts were no problem at all with format=XML. Also, I think it’s not permitted per se to have umlauts in site names, right? Otherwise we probably wouldn’t have been able to create these pages. So finally I conclude that this is actually kind of a bug in Piwik. No offense ;-).
What do you think? Should I rename these pages? It’s actually not that easy, because we have a job that automatically runs through a list of intranet pages (export from sharepoint) and creates Piwik sites for these pages if they don’t yet exist. So it’s kind of all wired up with these umlaut-names