elementor / static-html-output

Static HTML Output Plugin for WordPress
https://statichtmloutput.com
The Unlicense
125 stars 35 forks source link

new error exporting to github in 6.3 #174

Open dmeagor opened 5 years ago

dmeagor commented 5 years ago

2019-01-23 01:10:14 PHP VERSION 7.2.13 OS VERSION Linux ams203.hawkhost.com 2.6.32-896.16.1.lve1.4.49.el6.x86_64 leonstafford/wp2static#1 SMP Fri Jan 5 05:15:23 EST 2018 x86_64 WP VERSION 5.0.3 WP URL http://xxxx.xxxx.co.uk WP SITEURL http://xxxx.xxxx.co.uk WP HOME http://xxxx.xxxx.co.uk WP ADDRESS http://xxxx.xxxx.co.uk PLUGIN VERSION 6.3 VIA WP-CLI? STATIC EXPORT URL https://xxxx.xxxx2.com/ SAVING URL: FILE IS EMPTY /favicon.ico BAD RESPONSE STATUS (404): http://PLACEHOLDER.wpsho/ BAD RESPONSE STATUS FROM API (502) Deployment: error encountered Exception: BAD RESPONSE STATUS FROM API (502) in /home/wpstagep/xxxx.xxxx.co.uk/wp-content/plugins/static-html-output-plugin/library/StaticHtmlOutput/SitePublisher.php:312 Stack trace:

0 /home/wpstagep/xxxx.xxxx.co.uk/wp-content/plugins/static-html-output-plugin/powerpack/GitHub.php(290): StaticHtmlOutput_SitePublisher->checkForValidResponses(502, Array)

leonstafford/wp2static#1 /home/wpstagep/xxxx.xxxx.co.uk/wp-content/plugins/static-html-output-plugin/powerpack/GitHub.php(91): StaticHtmlOutput_GitHub->updateFileInGitHub() leonstafford/wp2static#2 /home/wpstagep/xxxx.xxxx.co.uk/wp-content/plugins/static-html-output-plugin/powerpack/GitHub.php(31): StaticHtmlOutput_GitHub->upload_files() leonstafford/wp2static#3 /home/wpstagep/xxxx.xxxx.co.uk/wp-content/plugins/static-html-output-plugin/powerpack/GitHub.php(352): StaticHtmlOutput_GitHub->__construct() leonstafford/wp2static#4 /home/wpstagep/xxxx.xxxx.co.uk/wp-content/plugins/static-html-output-plugin/library/StaticHtmlOutput/Dispatcher.php(42): require_once('/home/wpstagep/...') leonstafford/wp2static#5 /home/wpstagep/xxxx.xxxx.co.uk/wp-content/plugins/static-html-output-plugin/wp2static.php(17): require_once('/home/wpstagep/...') leonstafford/wp2static#6 /home/wpstagep/xxxx.xxxx.co.uk/wp-settings.php(322): include_once('/home/wpstagep/...') leonstafford/wp2static#7 /home/wpstagep/xxxx.xxxx.co.uk/wp-config.php(86): require_once('/home/wpstagep/...') leonstafford/wp2static#8 /home/wpstagep/xxxx.xxxx.co.uk/wp-load.php(37): require_once('/home/wpstagep/...') leonstafford/wp2static#9 /home/wpstagep/xxxx.xxxx.co.uk/wp-admin/admin-ajax.php(22): require_once('/home/wpstagep/...') leonstafford/wp2static#10 {main}

dmeagor commented 5 years ago

tried again with a .5 sec delay but same error.

leonstafford commented 5 years ago

Thanks @dmeagor. Working on a "Debugging mode" when exporting for easier debugging, but could you please try the following in Advanced Tab:

If that alone doesn't allow the export to complete, please try:

Increase the delay if still not completing.

I'm not yet convinced with the change I've done from the old GitHub deploy method (single-commit) to this one, in order to allow for incremental deploys. The advantage of this one is that if you can complete an export, subsequent ones will be much faster.

dmeagor commented 5 years ago

Deployment batch size is already set to 1 and api request delay is 0.5

leonstafford commented 5 years ago

Hi @dmeagor, sorry, I read it properly now and see the:

BAD RESPONSE STATUS (404): http://PLACEHOLDER.wpsho/

That may be unrelated to the API issue, but is worth looking into. What it means is that the plugin has failed to rewrite a local link on the original site properly.

It uses this PLACEHOLDER.wpsho first, as a way to normalize all URLs for later being more easily able to rewrite to the Destination URL.

When I implement the Debugging Mode option, we'll be able to see each action/request logged in order, so in this case, we're failing on a particular file, we'll know exactly which one it failed on.

I'm groping in the dark a bit until then, but this hints that it may be trying to send an empty file to the GitHub API:

https://stackoverflow.com/questions/21698009/github-api-502-error

I can give you a cpl of lines to paste in and get the exact file that's causing it, one minute...

leonstafford commented 5 years ago

Using the attached build, once export is done/failed, check the Export Log in the Logs tab and it should end at the failed file when using a Batch Size of 1

dmeagor_debug_urls.zip

leonstafford commented 5 years ago

dmeagor_debug_urls2.zip

leonstafford commented 5 years ago

@dmeagor, I've started the Debug Mode work with this build. If you check "Enable Debug Mode" in Advanced Tab, then check/refresh the Export Log, you should see the API responses from GitHub for the Create/Update requests.

expandgithubdebugging.zip

leonstafford commented 5 years ago

If you're not seeing any hints from those, the 502 may be coming from the other GH API request, which is hitting the GraphQL endpoint to check if a file exists remotely. Anyway, I'll keep expanding the debugging verbosity across the plugin to help with these kind of issues.

leonstafford commented 5 years ago

@dmeagor, one more recent version here worth trying. dmeager_debug_mode.zip

Please let me know what the Debug Mode outputs.

kencanak commented 5 years ago

Hey @leonstafford , I am encountering the same issue with version 6.5.1

This was the error

API response code 200 API response body {"data":{"repository":{"object":null}}} Creating public/xxx/index.html in GitHub API response code 422 API response body {"message":"Invalid request.\n\n\"sha\" wasn't supplied.","documentation_url":"https://developer.github.com/v3/repos/contents/#update-a-file"} BAD RESPONSE STATUS FROM API (422) Deployment: error encountered Exception: BAD RESPONSE STATUS FROM API (422)

leonstafford commented 5 years ago

Hi @kencanak,

Your issue seems a little different, as you're getting a 422 response code with a particular message from GitHub.

What I think is happening, is it's expecting a 'sha' value. The plugin, for this file, seems to be trying to do a CREATE, but an existing file was found in the repo and so it needs an UPDATE. Either the deploy cache from a previous deploy is incorrect or changes have been made to the repo outside of the plugin.

Please try these steps to troubleshoot:

failing that:

If you can email me the export log at this point, I may be able to deduce what's happening: leon@wp2static.com

Cheers,

Leon

dmeagor commented 5 years ago

Working on this. Delayed due to a different/unrelated issue with our server. I'll send over the log details as soon as I can.

leonstafford commented 5 years ago

no worries, @dmeagor, delay was probably a blessing as a few bugfixes went out in the meantime

kencanak commented 5 years ago

Hey @leonstafford , I am encountering the same issue with version 6.5.1

This was the error

API response code 200 API response body {"data":{"repository":{"object":null}}} Creating public/xxx/index.html in GitHub API response code 422 API response body {"message":"Invalid request.\n\n"sha" wasn't supplied.","documentation_url":"https://developer.github.com/v3/repos/contents/#update-a-file"} BAD RESPONSE STATUS FROM API (422) Deployment: error encountered Exception: BAD RESPONSE STATUS FROM API (422)

Hey @leonstafford , sent the log to you on Tuesday :)

skezo commented 5 years ago

With the latest build 6.5.3 I am getting a 500 error when uploading to Github.

Creating public/wp-content/uploads/2018/06/Article-768x403.jpg in GitHub
API response code 500
API response body 
BAD RESPONSE STATUS FROM API (500)
Deployment: error encountered
Exception: BAD RESPONSE STATUS FROM API (500) in /home/guff/public_html/wp-content/plugins/static-html-output-plugin/library/StaticHtmlOutput/SitePublisher.php:2
Stack trace:
#0 /home/guff/public_html/wp-content/plugins/static-html-output-plugin/powerpack/GitHub.php(14): StaticHtmlOutput_SitePublisher->checkForValidResponses(500, Array)
leonstafford/wp2static#1 /home/guff/public_html/wp-content/plugins/static-html-output-plugin/powerpack/GitHub.php(2): StaticHtmlOutput_GitHub->createFileInGitHub()
leonstafford/wp2static#2 /home/guff/public_html/wp-content/plugins/static-html-output-plugin/powerpack/GitHub.php(2): StaticHtmlOutput_GitHub->upload_files()
leonstafford/wp2static#3 /home/guff/public_html/wp-content/plugins/static-html-output-plugin/powerpack/GitHub.php(14): StaticHtmlOutput_GitHub->__construct()
leonstafford/wp2static#4 /home/guff/public_html/wp-content/plugins/static-html-output-plugin/library/StaticHtmlOutput/Dispatcher.php(2): require_once('/home/guff/...')
leonstafford/wp2static#5 /home/guff/public_html/wp-content/plugins/static-html-output-plugin/wp2static.php(17): require_once('/home/guff/...')
leonstafford/wp2static#6 /home/guff/public_html/wp-settings.php(305): include_once('/home/guff/...')
leonstafford/wp2static#7 /home/guff/public_html/wp-config.php(90): require_once('/home/guff/...')
leonstafford/wp2static#8 /home/guff/public_html/wp-load.php(37): require_once('/home/guff/...')
leonstafford/wp2static#9 /home/guff/public_html/wp-admin/admin-ajax.php(22): require_once('/home/guff/...')
leonstafford/wp2static#10 {main}
dmeagor commented 5 years ago

log sent privately.

dmeagor commented 5 years ago

Found a workaround by exporting to a static folder and doing git commit/push from the command line. which has reduced the deployment time from about 90 mins to about 4 and is much more secure.

Unfortunately relative urls are broken so I'm again at an impasse (listed as a separate issue.)

HeyNitin commented 3 years ago

2021-03-27 01:01:53 2021-03-26 07:31:53 PHP VERSION 7.4.13 OS VERSION Windows NT NITINS-PC 10.0 build 19042 (Windows 10) AMD64 WP VERSION 5.7 WP URL http://localhost/wordpress WP SITEURL http://localhost/wordpress WP HOME http://localhost/wordpress WP ADDRESS http://localhost/wordpress PLUGIN VERSION 6.6.21 VIA WP-CLI? STATIC EXPORT URL https://07nitin07.github.io/Decoding-D-Street PERMALINK STRUCTURE /%postname%/ SERVER SOFTWARE Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.4.13
2021-03-27 01:01:53 Active plugins:
2021-03-27 01:01:53 addons-for-elementor/addons-for-elementor.php
2021-03-27 01:01:53 all-in-one-wp-migration/all-in-one-wp-migration.php
2021-03-27 01:01:53 astra-sites/astra-sites.php
2021-03-27 01:01:53 elementor/elementor.php
2021-03-27 01:01:53 static-html-output-plugin/static-html-output-plugin.php
2021-03-27 01:01:53 wpforms-lite/wpforms.php
2021-03-27 01:01:53 Plugin options:
2021-03-27 01:01:54 additionalUrls:
2021-03-27 01:01:54 baseUrl:
2021-03-27 01:01:54 baseUrl-bitbucket:
2021-03-27 01:01:54 baseUrl-bunnycdn:
2021-03-27 01:01:54 baseUrl-github:
2021-03-27 01:01:54 baseUrl-gitlab:
2021-03-27 01:01:54 baseUrl-netlify:
2021-03-27 01:01:54 baseUrl-s3:
2021-03-27 01:01:54 baseUrl-zip:
2021-03-27 01:01:54 baseUrl-zip:
2021-03-27 01:01:54 basicAuthPassword:
2021-03-27 01:01:54 basicAuthUser:
2021-03-27 01:01:54 bbBranch:
2021-03-27 01:01:54 bbRepo:
2021-03-27 01:01:54 bbToken:

2021-03-27 01:01:54 bunnycdnStorageZoneAccessKey:
2021-03-27 01:01:55 bunnycdnPullZoneAccessKey:

2021-03-27 01:01:55 bunnycdnPullZoneID:
2021-03-27 01:01:55 bunnycdnStorageZoneName:
2021-03-27 01:01:55 bunnycdn_api_host:
2021-03-27 01:01:55 cfDistributionId:
2021-03-27 01:01:55 completionEmail:
2021-03-27 01:01:55 crawl_delay:
2021-03-27 01:01:55 crawl_increment:
2021-03-27 01:01:55 crawlPort:
2021-03-27 01:01:56 delayBetweenAPICalls:
2021-03-27 01:01:56 deployBatchSize:
2021-03-27 01:01:56 excludeURLs:
2021-03-27 01:01:56 ghBranch:
2021-03-27 01:01:56 ghCommitMessage:
2021-03-27 01:01:56 ghRepo:
2021-03-27 01:01:56 ghToken:

2021-03-27 01:01:56 glBranch:
2021-03-27 01:01:56 glProject:
2021-03-27 01:01:56 glToken:
2021-03-27 01:01:56 netlifyHeaders:
2021-03-27 01:01:56 netlifyPersonalAccessToken:

2021-03-27 01:01:56 netlifyRedirects:
2021-03-27 01:01:57 netlifySiteID:
2021-03-27 01:01:57 removeConditionalHeadComments: 1
2021-03-27 01:01:57 removeHTMLComments: 1
2021-03-27 01:01:57 removeWPLinks: 1
2021-03-27 01:01:57 removeWPMeta: 1
2021-03-27 01:01:57 rewrite_rules:
2021-03-27 01:01:57 rename_rules:
2021-03-27 01:01:57 s3Bucket:
2021-03-27 01:01:57 s3Key:
2021-03-27 01:01:57 s3Region:
2021-03-27 01:01:57 s3Secret: ***
2021-03-27 01:01:57 selected_deployment_option:
2021-03-27 01:01:57 targetFolder:
2021-03-27 01:01:57 useBasicAuth:
2021-03-27 01:01:57 Installed extensions:
2021-03-27 01:01:58 Core,bcmath,calendar,ctype,date,filter,hash,iconv,json,SPL,pcre,readline,Reflection,session,standard,mysqlnd,tokenizer,zip,zlib,libxml,dom,PDO,bz2,SimpleXML,xml,xmlreader,xmlwriter,apache2handler,openssl,curl,fileinfo,gd,gettext,mbstring,exif,mysqli,pdo_mysql,pdo_sqlite,Phar,ftp
2021-03-27 01:02:05 BAD RESPONSE STATUS (404): /ads.txt
2021-03-27 01:02:06 BAD RESPONSE STATUS (404): /astra-2/
2021-03-27 01:02:07 BAD RESPONSE STATUS (404): /astra-3/
2021-03-27 01:02:10 BAD RESPONSE STATUS (404): /astra-4/
2021-03-27 01:02:11 BAD RESPONSE STATUS (404): /astra-5/
2021-03-27 01:02:12 BAD RESPONSE STATUS (404): /astra-6/
2021-03-27 01:02:13 BAD RESPONSE STATUS (404): /astra-7/
2021-03-27 01:02:14 BAD RESPONSE STATUS (404): /astra/
2021-03-27 01:02:26 BAD RESPONSE STATUS (404): /favicon.ico
2021-03-27 01:02:28 BAD RESPONSE STATUS (404): /hestia/
2021-03-27 01:02:32 BAD RESPONSE STATUS (404): /robots.txt
2021-03-27 01:02:38 BAD RESPONSE STATUS (404): /twentytwentyone/
2021-03-27 01:02:40 BAD RESPONSE STATUS (404): /wordpress/
2021-03-27 01:02:41 BAD RESPONSE STATUS (404): /wordpress/2021/
2021-03-27 01:02:43 BAD RESPONSE STATUS (404): /wordpress/2021/03/
2021-03-27 01:02:44 BAD RESPONSE STATUS (404): /wordpress/2021/03/25/
2021-03-27 01:02:47 BAD RESPONSE STATUS (404): /wordpress/astra-2/
2021-03-27 01:02:48 BAD RESPONSE STATUS (404): /wordpress/astra-3/
2021-03-27 01:02:50 BAD RESPONSE STATUS (404): /wordpress/astra-4/
2021-03-27 01:02:52 BAD RESPONSE STATUS (404): /wordpress/astra-5/
2021-03-27 01:02:53 BAD RESPONSE STATUS (404): /wordpress/astra-6/
2021-03-27 01:02:54 BAD RESPONSE STATUS (404): /wordpress/astra-7/
2021-03-27 01:02:57 BAD RESPONSE STATUS (404): /wordpress/astra/
2021-03-27 01:03:04 BAD RESPONSE STATUS (404): /wordpress/hestia/
2021-03-27 01:03:14 BAD RESPONSE STATUS (404): /wordpress/twentytwentyone/
2021-03-27 01:03:46 BAD RESPONSE STATUS (404): /wp-content/uploads/2019/06/feature3-free-img.png
2021-03-27 01:03:59 Failed saving /wp-json/ to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/\/wp-json/index.
2021-03-27 01:03:59 BAD RESPONSE STATUS (400): /wp-json/oembed/1.0/embed
2021-03-27 01:04:01 Failed saving /wp-json/wp/v2/categories/6 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/categories/6/index.
2021-03-27 01:04:03 Failed saving /wp-json/wp/v2/pages/5 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/pages/5/index.
2021-03-27 01:04:07 Failed saving /wp-json/wp/v2/pages/540 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/pages/540/index.
2021-03-27 01:04:08 Failed saving /wp-json/wp/v2/pages/541 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/pages/541/index.
2021-03-27 01:04:09 Failed saving /wp-json/wp/v2/pages/6 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/pages/6/index.
2021-03-27 01:04:11 Failed saving /wp-json/wp/v2/pages/7 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/pages/7/index.
2021-03-27 01:04:12 Failed saving /wp-json/wp/v2/posts/712 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/posts/712/index.
2021-03-27 01:04:14 Failed saving /wp-json/wp/v2/posts/766 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/posts/766/index.
2021-03-27 01:04:15 Failed saving /wp-json/wp/v2/users/1 to C:\xampp\htdocs\wordpress/wp-content/uploads/static-html-output/wp-json/wp/v2/users/1/index.

So what's the issue here?