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

500 error returned - when generating static site with RankMath plugin activated #824

Open
jhatmaker opened this issue Oct 9, 2021 · 2 comments · May be fixed by #825
Open

500 error returned - when generating static site with RankMath plugin activated #824

jhatmaker opened this issue Oct 9, 2021 · 2 comments · May be fixed by #825
Assignees
Labels

Comments

@jhatmaker
Copy link

jhatmaker commented Oct 9, 2021

Plugin - Caused unhandled exception

Describe the bug
On a fresh install of WP with WP2Static and RankMath (free) activated, (using the SiteMap options in RankMath), the Generate static site will fail (browser reports a 500 error) and the log file will report an unhandled ClientException.

To Reproduce
Steps to reproduce the behavior:

  1. Install/Activate RankMath
  2. Make sure the options to include Posts, Pages, and Categories are turned on in Rank Math (if you turn off these options WP2Static will process normally, if any of the 3 options are on, WP2Static will fail).
  3. Select WP2Static -> Run and Press "Generate static site"
  4. See error

Expected behavior
WP2Static should not have an unhandled exception that causes the generate to fail.

Screenshots
If applicable, add screenshots to help explain your problem.
image
image
image
image

Environment (please complete the following information):

  • Hosting OS: Linux 0c15ac11f18a 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 GNU/Linux
  • (standard wordpress docker image)
  • Web server setup: Docker, apache, wordpress
  • Local host / Docker instance

Log files (please complete the following information):

Please ensure no sensitive information in your log files, then attach to your issue.

  • WP2Static Logs (found on WP dashboard > WP2Static > Logs)
2021-10-09 00:25:05: Unable to fetch URL contents
2021-10-09 00:25:05: Starting to detect WordPress site URLs.
2021-10-09 00:25:05: Starting URL detection
2021-10-09 00:25:05: Running WP2Static in Headless mode
2021-10-09 00:25:05: Running full workflow from UI
  • Server logs (PHP and webserver error logs)
Fatal error: Uncaught WP2StaticGuzzleHttp\Exception\ClientException: Client error: `GET http://wplocal.internal//wp-sitemap.xml` resulted in a `404 Not Found` response:
<!doctype html>
<html lang="en-US" >
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width (truncated...)
in /var/www/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /var/www/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Middleware.php(69): WP2StaticGuzzleHttp\Exception\RequestException::create(Object(WP2StaticGuzzleHttp\Psr7\Request), Object(WP2StaticGuzzleHttp\Psr7\Response), NULL, Array, NULL)
#1 /var/www/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticpromises/src/Promise.php(204): WP2StaticGuzzleHttp\Middleware::WP2StaticGuzzleHttp\{closure}(Object(WP2StaticGuzzleHttp\Psr7\Response))
#2 /var/www/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticpromises/src/Promise.php(153): WP2StaticGuzzle in /var/www/html/wp-content/plugins/wp2static/src/DetectSitemapsURLs.php on line 160

@jhatmaker jhatmaker linked a pull request Oct 9, 2021 that will close this issue
@john-shaffer john-shaffer self-assigned this Oct 9, 2021
john-shaffer added a commit that referenced this issue Oct 9, 2021
When creating a Psr7 request with a base_uri set in the Client and a
path that starts with // (like '//wp-sitemap.xml'), the path is
interpreted as an absolute URL and we get a ClientException for
'unknown host: wp-sitemap.xml'. This is fixed by removing base_uri
from the client and always making Requests with the full url.

This was discovered while debugging #824 and may address that issue.
@john-shaffer
Copy link
Contributor

Thanks for the detailed report!

I was not able to reproduce this issue exactly, but I did find a similar problem that may be related. Can you test with bbc8abb and see if that changes anything for you?

@crstauf
Copy link

crstauf commented Apr 6, 2022

I encountered this issue with v7.1.7, and I do not have RankMath plugin installed.

[06-Apr-2022 18:55:09 UTC] PHP Fatal error:  Uncaught WP2StaticGuzzleHttp\Exception\ClientException: Client error: `GET http://site.local//wp-sitemap.xml` resulted in a `404 Not Found` response:

Option siteurl does not have a trailing slash.

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

Successfully merging a pull request may close this issue.

3 participants