Closed leonstafford closed 3 years ago
Possibly fixed in this build. Please report if remains:
Not sure if related but was try to export on a new site and it throws the following:
PHP Fatal error: Uncaught WP2StaticGuzzleHttp\\Exception\\ClientException: Client error:
GET http://wordpress.example.co.uk/http://wordpress.example.co.uk/wp-sitemap.xml``
This is an existing site I've imported where I suspect the sitemap didn't exist... not sure why the site_url is being duplicated here but it Error 500s at the start of the crawl.
Strangely, the fix was to install Yoast to ensure a sitemap.xml was generated
@petewilcock did that build attached above solve that or are you running from latest source already?
@leonstafford I did try your downloaded build but still hit the same issue - my other version is a dev build I pulled a week or so ago
@petewilcock - I had a similar issue and installing Yoast to generate a sitemap.xml fixed it. Thanks for finding this!
Feb 6 22:45:06 web05 php: PHP Fatal error: Uncaught WP2StaticGuzzleHttp\Exception\ClientException: Client error: `GET https://mydomain.com/https://mydomain.com/sitemap.xml` resulted in a `404 Not Found` response:
Feb 6 22:45:06 web05 php: <!DOCTYPE html>
Feb 6 22:45:06 web05 php: <html lang="en-US">
Feb 6 22:45:06 web05 php: <head>
Feb 6 22:45:06 web05 php: <meta charset="UTF-8">
Feb 6 22:45:06 web05 php: <meta name="viewport" content="width=device-width, ini (truncated...)
Feb 6 22:45:06 web05 php: in /var/www/wordpress/mydomain/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Exception/RequestException.php:113
Feb 6 22:45:06 web05 php: Stack trace:
Feb 6 22:45:06 web05 php: #0 /var/www/wordpress/mydomain/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Middleware.php(69): WP2StaticGuzzleHttp\Exception\RequestException::create()
Feb 6 22:45:06 web05 php: #1 /var/www/wordpress/mydomain/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticpromises/src/Promise.php(204): WP2StaticGuzzleHttp\Middleware::WP2StaticGuzzleHttp\{closure}()
Feb 6 22:45:06 web05 php: #2 /var/www/wordpress/mydomain/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticpromises/src/Promise.php(153): WP2StaticGuzzleHttp\Promise\Promise::callHandler()
Feb 6 22:45:06 web05 php: #3 /var in /var/www/wordpress/mydomain/wp-content/plugins/wp2static/src/DetectSitemapsURLs.php on line 125
@petewilcock Same here, but I've got the sitemap.xml created by WP itself, got the very same error as happened to you (with duplicated URLs) installing Yoast helped.
I encountered this issue today, for me It was caused by my robots.txt file including the sitemap URL in it. The URL in the robots.txt file was the full URL (base site + sitemap.xml). Since the Client request includes the base URL this caused the double URL issue.
I worked around this by removing the sitemap from the robots.txt file.
@dardalios many thanks for reporting this, it should help get closer to solving it. I'm working on moving out all of the URL detection into its own library, for WP2Static and others to use. That may replace current sitemap/robots parsing code before I fix it in place.
I had the same issue due to the absolute URLs in robots.txt
generated by XML Sitemaps
To update on this, I've gotten some time again to work on https://github.com/leonstafford/WordPressURLDetector/, which will will become a drop-in replacement for all URL detection within WP2Static. Can't give an ETA of when it will be ready yet, just doing some tidy up/organising the code as a library. Sitemap bit that came from WP2Static is my least liked part of it, seems unecessarily complex and as we're seeing brittle. I've got a few ideas for much easier solutions.
In the meantime, it seems there's some workarounds people in this thread have suggested.
Just got the same problem and for a workaround I just this bit to the code:
foreach ( array_keys( $sitemaps ) as $sitemap ) {
if ( ! is_string( $sitemap ) ) {
continue;
}
$sitemap = '/' . str_replace(
$wp_site_url,
'',
$sitemap
);
What do you think about adding as a working fix?
Thanks @palmiak for the PR!
Here's the build of that zip if anyone who is still able to reproduce the issue can help test:
Just tested the new release on my server that was causing problems - it's working now with new version 🎉
I tried fixed version from @leonstafford and still getting 500 error. That's my error log file `#1 /home/new.skiddou.com/public_html/wp-content/plugins/wp2static/src/Controller.php(633): WP2Static\URLDetector::detectURLs()
2021-09-17 13:58:30.450832 [NOTICE] [3370032] [77.65.110.183:37637-Q:E9FCD96ED0517F03-4#new.skiddou.com] [STDERR] in} thrown in /home/new.skiddou.com/public_html/wp-content/plugins/wp2static/src/DetectSitemapsURLs.php on line 127`
That's my logs from Run section
2021-09-17 14:09:18: Unable to fetch URL contents 2021-09-17 14:09:13: Starting to detect WordPress site URLs. 2021-09-17 14:09:13: Starting URL detection 2021-09-17 14:09:13: Running WP2Static in Headless mode 2021-09-17 14:09:13: Running full workflow from UI 2021-09-17 14:08:38: Unable to fetch URL contents 2021-09-17 14:08:33: Starting to detect WordPress site URLs. 2021-09-17 14:08:33: Starting URL detection 2021-09-17 14:08:33: Running WP2Static in Headless mode 2021-09-17 14:08:33: Running full workflow from UI 2021-09-17 14:05:53: Unable to fetch URL contents 2021-09-17 14:05:46: Starting to detect WordPress site URLs. 2021-09-17 14:05:46: Starting URL detection 2021-09-17 14:05:46: Running WP2Static in Headless mode 2021-09-17 14:05:46: Running full workflow from UI 2021-09-17 14:00:34: Starting to detect WordPress site URLs. 2021-09-17 14:00:34: Starting URL detection 2021-09-17 14:00:34: Running WP2Static in Headless mode 2021-09-17 14:00:34: Running full workflow from UI 2021-09-17 13:58:30: Unable to fetch URL contents 2021-09-17 13:58:25: Starting to detect WordPress site URLs. 2021-09-17 13:58:25: Starting URL detection 2021-09-17 13:58:25: Running WP2Static in Headless mode 2021-09-17 13:58:25: Running full workflow from UI 2021-09-17 13:54:03: Unable to fetch URL contents 2021-09-17 13:53:58: Starting to detect WordPress site URLs. 2021-09-17 13:53:58: Starting URL detection 2021-09-17 13:53:58: Running WP2Static in Headless mode 2021-09-17 13:53:58: Running full workflow from UI 2021-09-17 13:45:04: Unable to fetch URL contents 2021-09-17 13:45:00: Starting to detect WordPress site URLs. 2021-09-17 13:45:00: Starting URL detection 2021-09-17 13:45:00: Running WP2Static in Headless mode 2021-09-17 13:45:00: Running full workflow from UI 2021-09-17 13:44:32: Unable to fetch URL contents 2021-09-17 13:44:27: Starting to detect WordPress site URLs. 2021-09-17 13:44:27: Starting URL detection 2021-09-17 13:44:27: Running WP2Static in Headless mode 2021-09-17 13:44:27: Running full workflow from UI
and error log with latest version of plugin `#8 /home/new.skiddou.com/public_html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/sr 2021-09-17 14:10:29.665439 [NOTICE] [3370032] [77.65.110.183:37731-Q:5371547D4AC5C5DF-48#new.skiddou.com] [STDERR] c/Middleware.php(63): WP2StaticGuzzleHttp\RedirectMiddleware->__invoke()
Next WP2Static\WP2StaticException: Unable to fetch URL contents in /home/new.skiddou.com/public_html/wp 2021-09-17 14:10:29.665453 [NOTICE] [3370032] [77.65.110.183:37731-Q:5371547D4AC5C5DF-48#new.skiddou.com] [STDERR] -content/plugins/wp2static/src/SitemapParser.php:239 Stack trace:
Next WP2Static\WP2StaticException: Unable to fetch URL contents in /home/new.skiddou.com/public_html/wp-content/plugins/wp2static/src/DetectSitemapsURLs.php:127 Stack trace:
2021-09-17 14:10:29.665458 [NOTICE] [3370032] [77.65.110.183:37731-Q:5371547D4AC5C5DF-48#new.skiddou.com] [STDERR] in} thrown in /home/new.skiddou.com/public_html/wp-content/plugins/wp2static/src/DetectSitemapsURLs.php on line 127 2021-09-17 14:11:00.795530 [INFO] [3370032] [skidd88363892.655340]: locked pid file [/tmp/lshttpd/skidd88363892.sock.pid]. 2021-09-17 14:11:00.795549 [INFO] [3370032] [skidd88363892.655340] remove unix socket for detached process: /tmp/lshttpd/skidd88363892.sock 2021-09-17 14:11:00.795617 [NOTICE] [3370032] [LocalWorker::workerExec] VHost:dev.skiddou.com suExec check uid 65534 gid 65534 setuidmode 0. 2021-09-17 14:11:00.795626 [NOTICE] [3370032] [LocalWorker::workerExec] Config[skidd88363892.655340]: suExec uid 1004 gid 1004 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 1004 gid 1004, flags: 0. 2021-09-17 14:11:00.795909 [NOTICE] [3370032] [skidd88363892.655340] add child process pid: 3370860 2021-09-17 14:11:00.795969 [INFO] [3370032] [skidd88363892.655340]: unlocked pid file [/tmp/lshttpd/skidd88363892.sock.pid]. `
Hi @adrianratajczak, looks like we need to improve our error messaging when that particular exception is thrown, as it doesn't tell us the exact URL it's failing on, only that there was a TransferException
.
Could you please list all the sitemaps your site has? And if it references the sitemaps in your robots.txt, if it exists.
That's my sitemap file https://new.skiddou.com/sitemap.xml
In my robots.txt sitemap is added
Thanks @adrianratajczak. I'm not yet sure of the issue, but in the meantime, you may try to remove the sitemaps reference from the robots.txt to see if that's the cause we're seeing here...
For those that land here and were a bit clueless like myself, these troubleshooting settings also help.
1) Check Wp2static > Diagnostics, resolve any issues (especially making sure /uploads is writable) 2) verify wp-content has full ownership inside the container. Do NOTE: php had an error i ignored. Even though i was within an acceptable version.
chown -R nginx:www-data wp-content/
I had copied files from the host and broke the file ownership. Symptoms presented as Themes and Addons being unable to be installed. Prompted for FTP login.
Once i fixed those two issues I was able to run OK. I had also went YOLO since it's a temp instance and created 777 permissions on those folder (probably not needed) and installed the and ran a quick SEO with Yoast.
I am getting this error as well. My Environment : Wordpress 5.9 with Wp2Static 7.1.7 (No Addons) on Laragon Local dev. I tried with both RankMath & Yoast with no success. My error:
My Wp2Static Log: 2022-02-21 10:12:13: Unable to fetch URL contents 2022-02-21 10:12:10: Starting to detect WordPress site URLs. 2022-02-21 10:12:10: Starting URL detection 2022-02-21 10:12:10: Running WP2Static in Headless mode 2022-02-21 10:12:10: Running full workflow from UI 2022-02-21 10:04:46: Unable to fetch URL contents 2022-02-21 10:04:44: Starting to detect WordPress site URLs. 2022-02-21 10:04:44: Starting URL detection 2022-02-21 10:04:44: Running WP2Static in Headless mode 2022-02-21 10:04:44: Running full workflow from UI 2022-02-21 10:03:51: Unable to fetch URL contents 2022-02-21 10:03:49: Starting to detect WordPress site URLs. 2022-02-21 10:03:49: Starting URL detection 2022-02-21 10:03:49: Running WP2Static in Headless mode 2022-02-21 10:03:49: Running full workflow from UI 2022-02-21 10:03:21: Unable to fetch URL contents 2022-02-21 10:03:19: Starting to detect WordPress site URLs. 2022-02-21 10:03:19: Starting URL detection 2022-02-21 10:03:19: Running WP2Static in Headless mode 2022-02-21 10:03:19: Running full workflow from UI 2022-02-21 10:02:54: Unable to fetch URL contents 2022-02-21 10:02:52: Starting to detect WordPress site URLs. 2022-02-21 10:02:52: Starting URL detection 2022-02-21 10:02:52: Running WP2Static in Headless mode 2022-02-21 10:02:52: Running full workflow from UI 2022-02-21 10:02:18: Unable to fetch URL contents 2022-02-21 10:02:16: Starting to detect WordPress site URLs. 2022-02-21 10:02:16: Starting URL detection 2022-02-21 10:02:16: Running WP2Static in Headless mode 2022-02-21 10:02:16: Running full workflow from UI 2022-02-21 10:01:42: Unable to fetch URL contents 2022-02-21 10:01:39: Starting to detect WordPress site URLs. 2022-02-21 10:01:39: Starting URL detection 2022-02-21 10:01:39: Running WP2Static in Headless mode 2022-02-21 10:01:39: Running full workflow from UI 2022-02-21 09:53:47: Unable to fetch URL contents 2022-02-21 09:53:45: Starting to detect WordPress site URLs. 2022-02-21 09:53:45: Starting URL detection 2022-02-21 09:53:45: Running WP2Static in Headless mode 2022-02-21 09:53:45: Running full workflow from UI 2022-02-21 09:50:35: Unable to fetch URL contents 2022-02-21 09:50:32: Starting to detect WordPress site URLs. 2022-02-21 09:50:32: Starting URL detection 2022-02-21 09:50:32: Running WP2Static in Headless mode 2022-02-21 09:50:32: Running full workflow from UI 2022-02-21 09:47:42: Unable to fetch URL contents 2022-02-21 09:47:40: Starting to detect WordPress site URLs. 2022-02-21 09:47:40: Starting URL detection 2022-02-21 09:47:40: Running WP2Static in Headless mode 2022-02-21 09:47:40: Running full workflow from UI 2022-02-21 09:47:01: Unable to fetch URL contents 2022-02-21 09:46:59: Starting to detect WordPress site URLs. 2022-02-21 09:46:59: Starting URL detection 2022-02-21 09:46:59: Running WP2Static in Headless mode 2022-02-21 09:46:59: Running full workflow from UI 2022-02-21 09:46:45: Unable to fetch URL contents 2022-02-21 09:46:43: Starting to detect WordPress site URLs. 2022-02-21 09:46:43: Starting URL detection 2022-02-21 09:46:43: Running WP2Static in Headless mode 2022-02-21 09:46:43: Running full workflow from UI
And the browser console view:
Not sure what causing the error.
SOLVED!
Dear @leonstafford Let me start with greetings! Disclaimer : we are more a digital & SEO agency and not the "hard coders". So, Accept our apologies in case we hurted the "coder's heart" (😄)
After some research and workaround, we have somehow managed to solve the issue. We consistently tried to install wp2static from the downloaded package from the official site. It Didn't work. Finally, we went on black white and green, the console way, cloned the GIT repo, ran composer install, and it worked like a charm!
Moreover, in your Cloudflare Workers Plugin we were not able to install through
composer build
, but it worked well with composer install
Hope this will help other noobs like us!
AmpliAds
@ampliads Did you solve the 500 error code? I'm having the same issue. Unable to fetch URL contents.
Hi @gabrfernandez ,
Yes. We are able to solve it.
May you give your working environment details with the log. In our case, the error was due to plugin files. I suggest you to use git clone
and then run composer install
In case you are not familiar with GIT then simply download the git repo as zip > unzip it into wp-content/plugins (it should create wp2static folder) > in terminal : get into directory and run composer install
(provided you have composer installed and set)
You may put the log output with browser console error Screenshot if possible.
Happy Wordpressing! 😊
@ampliads Glad you got it working! There hasn't been a release in some time, and there are a lot of fixes in the current git repo. In case it helps you, @gabrfernandez, I've attached the most recent build. wp2static-00582cf74c26a486538355e9f78338fd1bb86623.zip
@john-shaffer You are welcome! Personally, I feel, many wp users are marketing agencies / smo or tech noobs (just like us), may not be comfortable with git and the blacks, whites & greens (Collectively known as "the console" 😊) How about setting up instructions or creating a public blog with steps to get Git repo as zip!
Thanks for the feedback, @ampliads! Sorry, I'm playing catchup with questions and releases at the moment.
As of few days ago, you can grab latest release from wp2static.com/download, by filling out a form, it will get emailed to you. I'll get the latest changes bundled into a release soon for easier downloading. Thanks for your patience with all this and good job getting things working!
Dear @leonstafford ! I must say, the wp2static is doing a marvellous job! Wish long live to you and Wp2Static Team! Yes, Initially, I tried the download link and downloaded from the mail ID link only. But It didn't work. It is quite understandable. How about making an explainer video or a blog with a proper How-to (that will be "nearly once for all" ) Also, May you suggest us where we can have deeper dive and hands on experience for GithubPages Deployments? We have keen interest to move our sites on Github / GitLab Repo + Cloudflare Pages (We wisht o exclude the cloudflare workers) Aplologies for asking such qery on wrong thread.
Reported here:
https://staticword.press/t/the-plugin-returns-500/353/2
User: