Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in Admin Page - Plugins #1044

Closed
taechemist opened this issue Sep 14, 2016 · 41 comments
Closed

Errors in Admin Page - Plugins #1044

taechemist opened this issue Sep 14, 2016 · 41 comments
Labels

Comments

@taechemist
Copy link

I'm using local server "Xampp".
`Twig_Error_Runtime thrown with message "An exception has been thrown during the rendering of a template ("GPM not reachable. Please check your internet connection or check the Grav site is reachable") in "partials/plugins-list.html.twig" at line 19."

Stacktrace:
#31 Twig_Error_Runtime in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:402
#30 RuntimeException in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\GPM\GPM.php:473
#29 Grav\Common\GPM\GPM:findPackage in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:604
#28 call_user_func_array in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:604
#27 Twig_Template:getAttribute in C:\xampp\htdocs\grav-admin\cache\twig\b6\b6a16b9e99993d5305205028e010e1f471b3dfa16d9791de3725566abe70287b.php:72
#26 __TwigTemplate_812dd152f02b4c4e995fb2a2e134fb73f18fa1fc2bdaa0c164751063205c25e5:doDisplay in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:387
#25 Twig_Template:displayWithErrorHandling in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:355
#24 Twig_Template:display in C:\xampp\htdocs\grav-admin\cache\twig\4d\4d52b4af49aed4b34218dfba0d4aacb0e49c5ec1836447acc79aafdc1f78bf2f.php:218
#23 __TwigTemplate_d45efbb2ecfd1b6d175e48517c93ba1d3d4dbe975bc59085cd8b1e31d7a923f9:block_content in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:167
#22 Twig_Template:displayBlock in C:\xampp\htdocs\grav-admin\cache\twig\bc\bcedad5a9d9c096c0555639fe81c8eae8ad587d56962c88e545ddb97fbb1e4cb.php:205
#21 __TwigTemplate_a7caedeb0e8f9004b2ff859f14111da968f804e03a9687e4b90ccc5a5f872af1:block_page in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:167
#20 Twig_Template:displayBlock in C:\xampp\htdocs\grav-admin\cache\twig\bc\bcedad5a9d9c096c0555639fe81c8eae8ad587d56962c88e545ddb97fbb1e4cb.php:158
#19 __TwigTemplate_a7caedeb0e8f9004b2ff859f14111da968f804e03a9687e4b90ccc5a5f872af1:block_body in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:167
#18 Twig_Template:displayBlock in C:\xampp\htdocs\grav-admin\cache\twig\bc\bcedad5a9d9c096c0555639fe81c8eae8ad587d56962c88e545ddb97fbb1e4cb.php:45
#17 __TwigTemplate_a7caedeb0e8f9004b2ff859f14111da968f804e03a9687e4b90ccc5a5f872af1:doDisplay in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:387
#16 Twig_Template:displayWithErrorHandling in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:355
#15 Twig_Template:display in C:\xampp\htdocs\grav-admin\cache\twig\4d\4d52b4af49aed4b34218dfba0d4aacb0e49c5ec1836447acc79aafdc1f78bf2f.php:63
#14 __TwigTemplate_d45efbb2ecfd1b6d175e48517c93ba1d3d4dbe975bc59085cd8b1e31d7a923f9:doDisplay in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:387
#13 Twig_Template:displayWithErrorHandling in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:355
#12 Twig_Template:display in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Template.php:366
#11 Twig_Template:render in C:\xampp\htdocs\grav-admin\vendor\twig\twig\lib\Twig\Environment.php:347
#10 Twig_Environment:render in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Twig\Twig.php:340
#9 Grav\Common\Twig\Twig:processSite in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Service\OutputServiceProvider.php:19
#8 Grav\Common\Service\OutputServiceProvider:Grav\Common\Service{closure} in C:\xampp\htdocs\grav-admin\vendor\pimple\pimple\src\Pimple\Container.php:113
#7 Pimple\Container:offsetGet in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Processors\RenderProcessor.php:17
#6 Grav\Common\Processors\RenderProcessor:process in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Grav.php:121
#5 Grav\Common\Grav:Grav\Common{closure} in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Grav.php:396
#4 Grav\Common\Grav:Grav\Common{closure} in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Grav.php:372
#3 call_user_func_array in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Grav.php:372
#2 Grav\Common\Grav:__call in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Grav.php:122
#1 Grav\Common\Grav:measureTime in C:\xampp\htdocs\grav-admin\system\src\Grav\Common\Grav.php:122
#0 Grav\Common\Grav:process in C:\xampp\htdocs\grav-admin\index.php:45

`

@flaviocopes
Copy link
Contributor

Make sure you satisfy these requirements https://learn.getgrav.org/troubleshooting/common-problems#cannot-connect-to-the-gpm

@taechemist
Copy link
Author

I checked everything, but it's still not working.

@rhukster
Copy link
Member

  1. This is an admin issue, in future open here: https://github.com/getgrav/grav-plugin-admin/issues

  2. "GPM not reachable" - means what it says. Grav can't reach the GPM info on https://getgrav.org. Do you have a proxy server? Do you have a restrictive firewall? If not then, the cannot-connect-to-gpm documented flavio linked contains all the common issue we know of. Are you sure OpenSSL is installed and you have restarted your webserver since enabling it?

@taechemist
Copy link
Author

taechemist commented Sep 14, 2016

I don't have a proxy server. I've tried to disable firewall. I've check that OpenSSL is enable. I've tried everything. Also I get red alert every time I load admin page say:

this.data.feed_data is undefined at Grav</d</<.value@http://localhost/grav-admin/user/plugins/admin/themes/grav/js/admin.min.js?58888ea7a7:4:25071 Grav</d</<.value/<@http://localhost/grav-admin/user/plugins/admin/themes/grav/js/admin.min.js?58888ea7a7:4:24275 Grav</</o/<@http://localhost/grav-admin/user/plugins/admin/themes/grav/js/admin.min.js?58888ea7a7:4:23322

and

Error while trying to download 'https://getgrav.org/blog.atom'

And I've tried $ bit/gpm admin info, the result is GPM is not reachable.

Thank you in advance.

@w00fz
Copy link
Member

w00fz commented Sep 14, 2016

Please make sure it is actually enabled because I know XAMPP doesn't enable openssl by default.
Edit the proper php.ini file (or all of them if you have multiple PHP versions) and make sure you have this line uncommented:

[PHP_OPENSSL]
extension=php_openssl.dll

@taechemist
Copy link
Author

image

image

I've checked in php.ini, it's enable.

@maximelebreton
Copy link

maximelebreton commented Sep 16, 2016

same for me with easy php on windows, curl and open_ssl are enabled and same error on plugins and themes admin pages

@flaviocopes
Copy link
Contributor

Can you both try MAMP for Windows https://www.mamp.info/en/downloads/ and check if the issue persists? In case it's a matter of server configuration, if not it's something else.

@taechemist
Copy link
Author

I've tried MAMP, still not working.

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

Have a look at this issue starting from the point i link down #1008 (comment) . Maybe that'll help you.

Specifically I'm providing some commands that helped determine the issue seemed to be related to the hosting provider. I know you are working locally but it might give us some hints.

$ curl -I https://getgrav.org/downloads/plugins.json

@taechemist
Copy link
Author

image

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

Ok I am confused. Question: is if you go in the Plugins section, are you able to check for updates or is it failing? Do you get the error only in the Dashboard?

@taechemist
Copy link
Author

Dashboard:
image

Plugins and Themes:
image

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

Thanks. And if you do bin/gpm index -f you get the same?

@taechemist
Copy link
Author

image

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

Ok. Can you do me a favor and look in your php.ini if you have allow_url_fopen. If it's enabled, turn it off, if it's disabled, turn it on. Then try again and see if it makes any difference.

Sorry for all the directions I'm giving, I'm quite baffled and trying to understand what is causing the issue because from my point of view, it should work.

@taechemist
Copy link
Author

allow_url_fopen was enable, I turned it off, but nothing is changed.

Thanks,

@taechemist
Copy link
Author

taechemist commented Sep 16, 2016

btw, I've been using my apartment's WiFi, it's quite restrict. Could that be the problem? I have not tried using Grav with any other connections though.

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

You should get at least a different message in the error, as it should be going through cURL. I wonder if it didn't trigger it.

Also, if you can reach https://getgrav.org/downloads/plugins.json directly from your browser, you shouldn't have any issue with Grav.

Alright I have one other thing to try. Try editing the Response.php class (https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/GPM/Response.php#L176-L185) and invert the order of the checks, so instead of fopen first and curl later, make it curl first.

    private static function getAuto()
    {
        if (self::isCurlAvailable()) {
            return self::getCurl(func_get_args());
        }
        if (!ini_get('open_basedir') && self::isFopenAvailable()) {
            return self::getFopen(func_get_args());
        }
    }

Disclaimer: it is ALWAYS a bad idea to directly editing source files, this is for testing purposes only so for posterity, don't do this :)

@taechemist
Copy link
Author

taechemist commented Sep 16, 2016

I can reach https://getgrav.org/downloads/plugins.json.

After I've tried editing Response.php. I got errors like this:
image

And, all the same in Plugins section.

Agreed :)

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

In that same Response.php file, after line 43 (https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/GPM/Response.php#L43), can you add CURLOPT_SSL_VERIFYPEER => false?

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

Btw we are getting somewhere! It looks like the issue is how your machine interprets the SSL certificate we have for getgrav.org.

I'm not quite sure why it fails to verify that, it's a totally valid certificate. 🤔

@taechemist
Copy link
Author

taechemist commented Sep 16, 2016

CURLOPT_HEADER => false this line is already there in the file. Should I add or delete?

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

You should keep that one and add the CURLOPT_SSL_VERIFYPEER => false after.

@taechemist
Copy link
Author

Oh sorry my bad. lol.

@taechemist
Copy link
Author

Good news! It's working now.
image

@w00fz
Copy link
Member

w00fz commented Sep 16, 2016

Very interesting. I'm glad this works for you but at the same time I'm confused as to why it didn't in the first place 😄

If you look at our certificate analysis it is marked as grade A which makes it all weird as of why your machine was complaining about verifying the peer.

I think we will add a new system option to disable the peer verification (so you don't have to touch the source files manually) and a note in the docs at the troubleshooting section.

Thank you so much for bearing with me on this and helping out figuring out the problem. None of the team could reproduce this issue!

@taechemist
Copy link
Author

You're welcome, it's been my pleasure helping out.

Thank you too, I can now work on my class project. Thank you everyone 😀

@maximelebreton
Copy link

Works for me too with response.php edits, thanks!

@rhukster
Copy link
Member

Thanks we'll get this sorted for the next Grav release!

@w00fz
Copy link
Member

w00fz commented Sep 17, 2016

@maximelebreton out of curiosity could your describe your setup? Windows/Linux, php version, apache/Nginx and if windows/mac what bundle if any.

Thanks.

@maximelebreton
Copy link

Windows 10
Apache/2.4.18 (Win32) PHP/7.0.4
Local server with EasyPhp DevServer

image

@w00fz
Copy link
Member

w00fz commented Sep 19, 2016

I integrated a new set of options for GPM that will allow to nicely disable the verify peer. #1053
This will be available in the next release.

Thanks.

@jeffreyroshan
Copy link

response.php edit worked for me too. Thanks!

@judhi
Copy link

judhi commented Sep 26, 2016

I am sad to report that I have similar case with Grav installed on VPS with CentOS 5.11.
As previously discussed in issue #1008, setting verify_peer = false did help showing the normal pages and some Admin pages. But when I clicked on Plugin or Themes, I got this error message:

Server Error
Sorry, something went terribly wrong!

0 - An exception has been thrown during the rendering of a template ("GPM not reachable. Please check your internet connection or check the Grav site is reachable") in "partials/plugins-list.html.twig" at line 19.

For further details please review your logs/ folder, or enable displaying of errors in your system configuration.

Note that I already edit Response.php and added CURLOPT_SSL_VERIFYPEER => false** below CURLOPT_HEADER => false (line 43).

and also on line 348 (347 on the original file), added:

    curl_setopt($rch, CURLOPT_HEADER, false);
    curl_setopt($rch, CURLOPT_SSL_VERIFYPEER, false);

I feel sad because I really like Grav but tired of all of this SSL incompatibility issues :)

@judhi
Copy link

judhi commented Sep 26, 2016

Update:

Out of curiosity I just commented out line 19 of user/plugins/admin/themes/grav/templates/partials/plugins-list.html.twig and it works!

    {#% set releaseDate = plugin.date ?: admin.gpm.findPackage(slug).date %#}

I've got similar error when clicking on Theme tab of Admin page

Server Error
Sorry, something went terribly wrong!

0 - An exception has been thrown during the rendering of a template ("GPM not reachable. Please check your internet connection or check the Grav site is reachable") in "partials/themes-list.html.twig" at line 21.

For further details please review your logs/ folder, or enable displaying of errors in your system configuration.

So, again I just commenting out the mentioned line in user/plugins/admin/themes/grav/templates/partials/themes-list.html.twig:

    {#% set releaseDate = theme.date ?: admin.gpm.findPackage(slug).date %#}

and it works!

Still not sure why and what I am missing here.

@gianlucasavini
Copy link

My two cents, on MAMP/Mac, switching to PHP 7 solved the issue

@AVDW
Copy link

AVDW commented Nov 14, 2016

I've been having the same issues on Azure with PHP 7 in IIS, I've tried all the edits to response.php, enabled and disabled settings everywhere but the solution @judhi posted worked for me! Thanks @judhi !

@flaviocopes
Copy link
Contributor

Removing that line works because eliminates the connection to the GPM, but I guess installing or updating any plugin/theme won't work.

@AVDW
Copy link

AVDW commented Nov 15, 2016

@flaviocopes you're right, installing and updating does not work once that line is removed.
I ended up putting those lines back in, deleted the cache, restarted the server then ran the following from the grav troubleshooting page through the built in CMD interface on Azure. Using anything else apparently doesn't actually change the permissions on the folders.
find . -type f | xargs chmod 664
find ./bin -type f | xargs chmod 775
find . -type d | xargs chmod 775
find . -type d | xargs chmod +s

After that everything was working. I also went back into the configuration and turned on Remote Verify Peer and Remote Fetch Method to auto.

@ghost
Copy link

ghost commented Jul 9, 2017

I was experiencing the same problem today. @AVDW is correct. The grav documentation is correct. Run the commands he mentions in the Azure app service console or the KConsole. Restart the app service and no more errors. FYI...the commands only work at the wwwroot folder. Any higher up and you will get errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants