getgrav / grav-plugin-admin

Grav Admin Plugin
http://getgrav.org
MIT License
355 stars 227 forks source link

Can't update any plugins #2142

Open glasswork opened 3 years ago

glasswork commented 3 years ago

I, all of a sudden, can't update any plugins: "TypeError: Failed to fetch."

I was initially using Grav v1.6.30 but tried with all versions of grav through v1.7.14.

As per another ticket ( Originally posted by @rhukster in https://github.com/getgrav/grav-plugin-admin/issues/1847#issuecomment-595800309 ) I used every possible value (auto, fopen, cURL) for the Remote Fetch Method config.

This occurs in Chrome AND Firefox.

glasswork commented 3 years ago

I had managed to get the first bit where it goes to dependencies to seem like it worked, but then it still failed, so I opened this back up.

To be clear: I can update Grav, but not Plugins OR Themes.

edit --- On Safari the error notice is "Fetch Failed: The network connection was lost." I should also probably mention that this was on a Mac Mojave and php 7.3.

mahagr commented 3 years ago

Have you tried to update plugins from CLI?

I'm asking because of it tells if the issue is in admin or somewhere else.

glasswork commented 3 years ago

Very deliberately ... no ... since, while that might update the plugins, it would be unlikely to solve the issue. I'd like to solve (and understand) the issue if I can ;)

But I will do it on one machine I have to test your hypothesis and see whether it is an Admin issue. BTW - on that score: I am running v1.9.1 of Admin.

glasswork commented 3 years ago

Yes, updating from CLi worked, so it IS likely to have been an admin issue. And since it was, I suppose there is a chance that the update to v1.9.18 fixed the issue. Sadly there are no further updates for the moment on which to test that theory, but I will try and manually bring over some old plugins later today for testing purposes.

glasswork commented 3 years ago

That being done, my site is broken in several ways which I will have to investigate. I am still getting the "Fetch Failed: The network connection was lost." when I try and clear the cache through the admin. Tried all values available for the Remote Fetch Method. So, plugins have been updated, but my Grav site is no more functional than it was ... not exactly the hoped for result ;)

mahagr commented 3 years ago

I've never run into an issue like this, but my guess is that something fails and the PHP crashes when trying to clear the cache. Try looking into php and apache logs if there's some error happening there.

glasswork commented 3 years ago

Hmmm ... for testing purposes I created a new Grav install with the latest version of Grav and the Admin plugin. And started (one-by-one) importing my plugins. All was going fine until I went into the admin plugin and set the Administrator Path to the value I have been using for years (i.e. not '/admin'), and the next old plugin I pulled over and tried to update failed in the way described above. When I changed the value back to '/admin' updating the plugins started to work again. Maybe there is a hardcoded path somewhere no longer taking that var for Administrator path into consideration?

glasswork commented 3 years ago

I just don't understand the relationship to the operating system. That is: two different versions of Mac failed (Mojave and Catalina), but a Win machine didn't seem to have any difficulty with the difference in path.

rhukster commented 3 years ago

We develop on Mac and have never run into this so i don’t think it’s a broad macOS issue.

glasswork commented 3 years ago

It is odd, for sure. I am going to play around some more and see if I can isolate the issue using the log from the two mac machines.

mahagr commented 3 years ago

Do you have any special characters in admin url?

glasswork commented 3 years ago

no, just lowercase letters

glasswork commented 3 years ago
  1. Mojave machine won't work with Grav 1.7+ because it was running php7.3.26. Will fix that in a bit, but using it for testing.
  2. Catalina machine will work with Grav 1.7+ because it has php7.3.6 , but only using default value for Administrator Path.
  3. Win machine will work with Grav 1.7+ because it has php7.4+, and it doesn't care what is used for Administrator Path. But, I haven't updated that to new grav version or updated all the plugins on that one.

Still working through everything.

glasswork commented 3 years ago

Just incidentally, I can make a separate issue for this, but the admin needs a bit of css to contain its content:

Screen Shot 2021-05-13 at 6 53 44 AM

This is fixed by adding:

.form-list-wrapper ul[data-collection-holder] > li.collection-collapsed { overflow:hidden; }

Fix tested using the Customadmin plugin.

mahagr commented 3 years ago

@glasswork Please make a new issue about it. :)

mahagr commented 3 years ago

Grav should work perfectly with PHP 7.3. Which version of Grav are you on now?

glasswork commented 3 years ago

By the way: I have now updated an existing branch and also made a completely clean new download, and both have the same issues.

Grav works with php 7.3.6 (or so it says on the tin). It was running before I started upgrading on PHP 7.3.26 - although I would see the "failed to fetch" notices occasionally even then. Now, running v1.7.14 with all up-to-date plugins, it throws the "failed to fetch" error even when I ask it to look for updates, let alone do updates. I can still use cli to update. But I want to have full-functionality.

Also, for what it is worth, it no longer throws "failed to fetch" errors when doing any of the "clear cache" functions - which it used to always do before upgrading.

I am running it on a my own system at a .local domain (to get around Chrome's unwillingness to allow one to use .dev any longer). And it is not run locally as https.

I actually have grav work to do this morning so I will have to switch to another branch (without the updates) to get stuff done. I have not pulled all the updates into my master, nor will i until I figure out what is going on.

mahagr commented 3 years ago

After reading your messages again, I am wondering if your PHP crashes. Can you test updates again and the same time look if new entries appear to either Apache error logs or Grav logs?

glasswork commented 3 years ago

I do have a repeating php error in my Apache2 log (I've been meaning to check my error logs for some time but life and death happened).

[php7:error] [pid 8018] [client 127.0.0.1:58431] PHP Fatal error: Grav\Plugin\Admin\Admin::messages(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Grav\Framework\Session\Messages" of the object you are trying to operate on was loaded before unserialize() gets called or provide an autoloader to load the class definition in /Users/myuser/myfolder/mysite/user/plugins/admin/classes/admin.php on line 353

glasswork commented 3 years ago

If I add a new plugin, it says dependencies install successfully but plugin will fail.

glasswork commented 3 years ago

On one machine I am getting the following in the pache2 log: [core:notice] [pid 60537] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [core:notice] [pid 60537] AH00052: child pid 60541 exit signal Segmentation fault (11)

mahagr commented 3 years ago

Try again but look if there are new entries in the log. We need to be sure that is the error that happens during the request.

Segmentation fault is always a PHP bug, the first one is really odd as the autoloader should find the file.

glasswork commented 3 years ago

Yep, that is it ... at least on the one machine. Will try the other on Monday.