Error Using WP-Cli

Not sure if I’ve done something wrong - I can generate the static HTML (and can do everything through the web interface). Hopefully I’ve done something wrong that’s simple :slight_smile:

But if I try to use wp-cli I get the following traceback;

bdr@ruby:~/httpdocs$ wp statichtmloutput deploy
Deploying static site
PHP Fatal error: Uncaught Error: Call to a member function request() on null in /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/BunnyCDN.php:191
Stack trace:
#0 /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/BunnyCDN.php(100): StaticHTMLOutput\BunnyCDN->createFileInBunnyCDN()
#1 /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/Deployer.php(64): StaticHTMLOutput\BunnyCDN->upload_files()
#2 /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/CLI.php(153): StaticHTMLOutput\Deployer->deploy(false)
#3 [internal function]: StaticHTMLOutput\CLI->deploy(Array, Array)
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(98): call_user_func(Array, Array, Array)
#5 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure}(Array, Array)
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php in /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/BunnyCDN.php on line 191
Fatal error: Uncaught Error: Call to a member function request() on null in /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/BunnyCDN.php:191
Stack trace:
#0 /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/BunnyCDN.php(100): StaticHTMLOutput\BunnyCDN->createFileInBunnyCDN()
#1 /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/Deployer.php(64): StaticHTMLOutput\BunnyCDN->upload_files()
#2 /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/CLI.php(153): StaticHTMLOutput\Deployer->deploy(false)
#3 [internal function]: StaticHTMLOutput\CLI->deploy(Array, Array)
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(98): call_user_func(Array, Array, Array)
#5 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure}(Array, Array)
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php in /var/www/vhosts/beardeddragonsrock.com/httpdocs/wp-content/plugins/static-html-output-plugin/src/BunnyCDN.php on line 191
Error: There has been a critical error on your website.Learn more about debugging in WordPress. There has been a critical error on your website.

Hmm, do you recall how far into the deployment it progressed? It may be hitting rate limit or some other issue with the API connectivity.

Looking at the code, that error looks likely only if settings aren’t there.

When you run from the UI, I believe you can run with the fields input, but not saved, so is it possible that the settings aren’t saved, thereby not available to the CLI?

To test, you can run the WP-CLI command to print out the settings, something like statichtmloutput options list

Hi Leon,
Thanks for the swift response - I must admit that’s what I thought (re: settings not being saved) but they definitely are.

The generate command works, the deploy doesn’t - it errors immediately.

Output from options list command is below if it helps :slight_smile:

mostuseful@ruby:~/httpdocs$ wp statichtmloutput options list
±------------------------------±----------------------------+
| Option name | Value |
±------------------------------±----------------------------+
| additionalUrls | |
| baseUrl | https://www.most-useful.com |
| baseUrl-bitbucket | |
| baseUrl-bunnycdn | https://www.most-useful.com |
| baseUrl-github | |
| baseUrl-gitlab | |
| baseUrl-netlify | |
| baseUrl-s3 | |
| baseUrl-zip | |
| baseUrl-zip | |
| basicAuthPassword | ******************* |
| basicAuthUser | |
| bbBranch | |
| bbRepo | |
| bbToken | ******************* |
| bunnycdnStorageZoneAccessKey | ******************* |
| bunnycdnPullZoneAccessKey | ******************* |
| bunnycdnPullZoneID | 172491 |
| bunnycdnStorageZoneName | mostusefulstorage |
| bunnycdn_api_host | ******************* |
| cfDistributionId | |
| completionEmail | 1 |
| crawl_delay | 0 |
| crawl_increment | 25 |
| crawlPort | |
| delayBetweenAPICalls | 0 |
| deployBatchSize | 25 |
| excludeURLs | |
| ghBranch | |
| ghCommitMessage | |
| ghRepo | |
| ghToken | ******************* |
| glBranch | |
| glProject | |
| glToken | ******************* |
| netlifyHeaders | |
| netlifyPersonalAccessToken | ******************* |
| netlifyRedirects | |
| netlifySiteID | |
| removeConditionalHeadComments | 1 |
| removeHTMLComments | 1 |
| removeWPLinks | 1 |
| removeWPMeta | 1 |
| rewrite_rules | |
| rename_rules | |
| s3Bucket | |
| s3Key | |
| s3Region | |
| s3Secret | ******************* |
| selected_deployment_option | bunnycdn |
| targetFolder | |
| useBasicAuth | |
±------------------------------±----------------------------+

Hmm, nothing weird looking there.

It may well be a bug, though I thought I’d tested all CLI deployers in that build. May need to wait a while for me to test myself unless @gulshan can confirm Bunny is deploying via CLI for him?

Your workaround for now is to run via UI, I guess, sorry!

No probs mate, happy to run from UI (prefer cli, but happy to wait :))

Thanks for having a look for me! Will wait to hear what @gulshan has to say too :slight_smile:

Gotta say, loving the ability to build in WordPress then deploy everything to a CDN :slight_smile:

1 Like

Cool - always happy to hear when it can help!

I’m in habit of plugging this project that’s got some big improvements this week you may like to checkout: Lokl very early stages, but looks promising in being a great local dev environment for WP (maybe other things later).

Looking for feedback on people’s workflows, ie what’s missing. I don’t build anything with WordPress these days, so keen to add in a few user personas, ie someone like you may want to schedule CRON deployments or trigger the build and deploys simultaneously across 50 sites, whatever it may be.

What I like about it, is that once the minimal requirements are installed on Mac/Win/Linux, then it’s a consistent, optimized environment for all users vs the great unknown of 10,000’s of users running WP2Static in all kinds of environments today!

Sorry, I have not tried CLI method. Web UI works fine as tested multiple times.

1 Like

Thanks @gulshan! I’ll add an issue and check it