amp-wp icon indicating copy to clipboard operation
amp-wp copied to clipboard

Connection Lost issue

Open drnick2 opened this issue 7 years ago • 11 comments

When updating posts or pages on Wordpress, I receive and error:" Connection lost. Saving has been disabled until you’re reconnected. We’re backing up this post in your browser, just in case." After deactivating and activating plugins, the Amp plugin is the culprit. When deactivated a post or page is updated immediately. When activated and trying to save a post I receive a connection error after 30 seconds and after a minute or so I receive a 504- Gateway timeout. When I refresh the page it saves almost instantly. Any help would be appreciated on eliminating this issue with the AMP plugin, thank you.

drnick2 avatar Feb 04 '19 19:02 drnick2

Which mode are you in? Classic, Paired, or Native?

westonruter avatar Feb 04 '19 19:02 westonruter

I am in paired mode.

drnick2 avatar Feb 04 '19 19:02 drnick2

Do you have a persistent object cache plugin enabled? That would be the first thing time able that would improve the performance not only of the AMP plugin but of your entire site generally. Also try to make sure you are on PHP 7+.

westonruter avatar Feb 04 '19 21:02 westonruter

Thanks for your reply's. There are no Cache plugins installed and I am using PHP 7.0

drnick2 avatar Feb 04 '19 21:02 drnick2

Try enabling a persistent object cache plugin (e.g. in conjunction with Memcached or Redis): https://codex.wordpress.org/Class_Reference/WP_Object_Cache#Persistent_Cache_Plugins

I use https://wordpress.org/plugins/wp-redis/

westonruter avatar Feb 04 '19 21:02 westonruter

Thank you, regarding Redis, does my host server need to have this or does it need to be installed? Or does the plugin work as is when activated?

drnick2 avatar Feb 04 '19 22:02 drnick2

It's something your host has to provide.

westonruter avatar Feb 04 '19 23:02 westonruter

Thanks, I do not think they do but I will check. So from what you are telling me this plugin will not work without giving me a connection error unless I use some sort of object cache plugin?

drnick2 avatar Feb 04 '19 23:02 drnick2

Not necessarily, but object caching should help. If your server is under-powered then you may need to remain on the classic mode.

As an alternative test, try going to a URL on your site and include ?amp_validate in the URL. If that takes a very long time to respond, then that is why the timeout may be happening.

westonruter avatar Feb 05 '19 00:02 westonruter

Thanks, tried your suggestion and the site loaded up in 2 seconds.

drnick2 avatar Feb 05 '19 00:02 drnick2

The other thing to make sure of is that loopback requests work properly. For example, try scheduling a post for publishing a couple minutes in the future. If the post never gets published and instead you see a "Missed Schedule" message, then that indicates that WordPress isn't able to make an HTTP request back onto itself. This is required for the AMP validation to work properly.

westonruter avatar Feb 05 '19 01:02 westonruter