elementor / wp2static

WordPress static site generator for security, performance and cost benefits
https://wp2static.com
The Unlicense
1.42k stars 269 forks source link

Error 504 on static site generation (WP2Static) #787

Open fazalfarhan01 opened 3 years ago

fazalfarhan01 commented 3 years ago

Hey there.

The static site generation used to work fine but i am not able to run it from a few hours.

I get this error:

504 error code returned from server.
Please check your server's error logs or try increasing your 
max_execution_time limit in PHP if this consistently fails 
after the same duration.
More information of the error may be logged in your browsers console. 

And this is what I get in the console:

load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.7.1:5 JQMIGRATE: Migrate is installed, version 3.3.2
load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.7.1:2 POST https://customer-care-solution.com/wp-admin/admin-ajax.php?_fs_blog_admin=true 500
send @ load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.7.1:2
ajax @ load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.7.1:2
s.ajax.s.ajax @ load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.7.1:5
(anonymous) @ admin.php?page=wp2static:566
dispatch @ load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.7.1:2
v.handle @ load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.7.1:2
admin.php?page=wp2static:547 
admin.php?page=wp2static:548 <p>There has been a critical error on this website.</p><p><a href="https://wordpress.org/support/article/faq-troubleshooting/">Learn more about troubleshooting WordPress.</a></p>

Tried wp-cil

$ wp wp2static full_workflow
[2021-05-01T14:34:53+05:30] Starting to detect WordPress site URLs.
[2021-05-01T14:34:55+05:30] Detection complete. 4435 URLs added to Crawl Queue.
[2021-05-01T14:34:55+05:30] Starting crawling
[2021-05-01T14:34:55+05:30] Starting to crawl detected URLs.
[2021-05-01T14:34:55+05:30] Using CrawlCache.
[2021-05-01T14:35:00+05:30] 404 for URL /blog/page/1/
[2021-05-01T14:35:00+05:30] 404 for URL /blog/page/2/
[2021-05-01T14:35:03+05:30] 404 for URL /favicon.ico
[2021-05-01T14:35:08+05:30] 404 for URL /sitemap.xml
[2021-05-01T14:35:59+05:30] Crawling progress: 300 crawled, 3887 skipped (cached).
PHP Fatal error:  Uncaught WP2StaticGuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve host: customer-care-solution.comhttp (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://customer-care-solution.comhttp/customer-care-solution.com/wp-content/plugins/all-in-one-wp-migration/lib/view/assets/css/backups.min.css in /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php:210
Stack trace:
#0 /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php(158): WP2StaticGuzzleHttp\Handler\CurlFactory::createRejection()
leonstafford/lokl#1 /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php(110): WP2StaticGuzzleHttp\Handler\CurlFactory::finishError()
leonstafford/lokl#2 /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlHandler.php(47): WP2StaticGuzzleHttp\Handler\CurlFactory::finish()
leonstafford/lokl#3 /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2stati in /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php on line 210
Fatal error: Uncaught WP2StaticGuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve host: customer-care-solution.comhttp (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://customer-care-solution.comhttp/customer-care-solution.com/wp-content/plugins/all-in-one-wp-migration/lib/view/assets/css/backups.min.css in /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php:210
Stack trace:
#0 /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php(158): WP2StaticGuzzleHttp\Handler\CurlFactory::createRejection()
leonstafford/lokl#1 /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php(110): WP2StaticGuzzleHttp\Handler\CurlFactory::finishError()
leonstafford/lokl#2 /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlHandler.php(47): WP2StaticGuzzleHttp\Handler\CurlFactory::finish()
leonstafford/lokl#3 /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2stati in /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php on line 210
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.

In the line PHP Fatal error: Uncaught WP2StaticGuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve host: customer-care-solution.comhttp (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://customer-care-solution.comhttp/customer-care-solution.com/wp-content/plugins/all-in-one-wp-migration/lib/view/assets/css/backups.min.css in /usr/html/wp-content/plugins/wp2static/vendor/leonstafford/wp2staticguzzle/src/Handler/CurlFactory.php:210 Stack trace:

Why is http being appended to customer-care-solution.com? And how do I solve this?

My setup:

  1. Lokl site with a reverse proxy running on https.
  2. Static site accessible on customer-care-solution.com.
  3. Modified host files on my computer to point to dynamic WordPress site.
fazalfarhan01 commented 3 years ago

Found a workaround

leonstafford commented 3 years ago

@fazalfarhan01 I've moved this into WP2Static repo for now. It may still be related to this network connectivity issue

But, I really should improve the error handling in WP2Static to provide better feedback about the cause when you're running via the UI and to add some re-attempts on URL crawls if not already, which may have fixed this issue, where it looks like it wasn't able to connect to customer-care-solution.com.

jakob-lundberg commented 3 years ago

I don't think this is related to connectivity issues. It looks like the domain it is trying to resolve is customer-care-solution.comhttp and not customer-care-solution.com

leonstafford commented 3 years ago

Probably due to the https reverse proxy? (sorry, just read/digested the part at the end about about your setup now)

Common to WP2Static, is that it needs the Site URL of the WP site to be the same that it's crawling, as much logic relies on that.

So, yeah, that setup is not supported today. Whether it is possible is another matter.

leonstafford commented 3 years ago

Sorry, brain not functioning well at end of day, but that is the general issue here. If you're able to keep the WP Site URL the same as the URL it's served from and WP2Static crawls, then it should be fine.

ZhymabekRoman commented 3 years ago

Same error image Is there any solution?

leonstafford commented 3 years ago

@ZhymabekRoman quick solution will be to change environments. You can try https://lokl.dev and import your site there or use any other VPS.

If issue persists, try with default WP site. Then re-enable piece of your site until problem reoccurrs, then we will know the exact cause.

fazalfarhan01 commented 3 years ago

Found a workaround

  • Used the scheduled jobs queue to generate static site with out errors.

@ZhymabekRoman did you try this?

rajeevbohan commented 3 years ago

Stuck with same error

504 error code returned from server. Please check your server's error logs or try increasing your max_execution_time limit in PHP if this consistently fails after the same duration.

rajeevbohan commented 3 years ago

My scheduled jobs are always in waiting status