TechToSpeech / terraform-aws-serverless-static-wordpress

Terraform module for deploying Serverless Static Wordpress on AWS
GNU General Public License v3.0
196 stars 69 forks source link

Generate static site fails fast with 500 error #50

Open nvnivs opened 2 years ago

nvnivs commented 2 years ago

When generating a static site, getting a 500 error straight away.

This is the error on the container logs:

[Tue Mar 22 08:13:24.798527 2022] [php7:error] [pid 114] [client 1.2.3.4:30368] PHP Fatal error:  Uncaught WP2StaticGuzzleHttp\\Exception\\ClientException: Client error: `GET http://wordpress.example.com/http://wordpress.example.com/wp-sitemap.xml` resulted in a `404 Not Found` response:\n<!DOCTYPE html>\n\n<html lang="pt-PT">\n\n<head>\n\t<title>P\xc3\xa1gina n\xc3\xa3o encontrada &#8211;</title>\n<meta name (truncated...)\n in /var/www/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Exception/RequestException.php:113\nStack trace:\n#0 /var/www/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Middleware.php(69): WP2StaticGuzzleHttp\\Exception\\RequestException::create()\n#1 /var/www/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticpromises/src/Promise.php(204): WP2StaticGuzzleHttp\\Middleware::WP2StaticGuzzleHttp\\{closure}()\n#2 /var/www/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticpromises/src/Promise.php(153): WP2StaticGuzzleHttp\\Promise\\Promise::callHandler()\n#3 /var/www/html/wp-content/plugins/wp2static/vendor/leonsta in /var/www/html/wp-content/plugins/wp2static/src/DetectSitemapsURLs.php on line 125, referer: http://wordpress.example.com/wp-admin/admin.php?page=wp2static

Looks like the same issue reported here: https://staticword.press/t/404-error-when-crawling-sitemap/368/7, fixed in this commit: https://github.com/leonstafford/wp2static/commit/59540b17d875da2c418709caa2893e12832aef7e

Think the issue is that the package under modules/codebuild/codebuild_files/serverless-wordpress-wp2static.zip was generated on Jun 19, 2021 and the package v7.1.7 containing the fix on Sep 5, 2021.

petewilcock commented 2 years ago

Good call. I did deliberate about passing in an attribute and explicitly downloading a dynamic package for WP2Static so it's not fixed in the bundled zip, but it's also released fairly infrequently and I wanted to guarantee functionality of a version I'd tested. It definitely needs an update though so I can grab the latest source, recompile, and bundle in an update.

nvnivs commented 2 years ago

Bundling it does make sense to guarantee results, but adding the attribute would be valuable.

It could default to a known good version (ex 7.1.7) and downloadfrom the releases on container build.

Would also give users the flexibility to pin to a particular version, but this would be an enhancement of course.