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

Try wp-now for local development #2343

Draft
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Draft

Try wp-now for local development #2343

wants to merge 6 commits into from

Conversation

adamwoodnz
Copy link
Contributor

@adamwoodnz adamwoodnz commented Mar 20, 2024

Add a blueprint to enable local development. This needs to replicate everything we currently do with wp-env.

Currently does not work.

Problems

1. Theme and plugin specified in blueprint are not activated
2. For wp-now to be a dev dependency, the Node 18.18.2 requirement for blueprint files requires updates to other tooling (eg. current jsdoc dependency does not support Node 18.18.2)
3. wp-content/mu-plugins are not loaded

How to test

Install PHP and JS dependencies as normal and build the project

  1. Run composer install
  2. Run nvm use
  3. Run yarn
  4. Run yarn workspaces run build

Switch to Node 18.18.2 and install wp-now globally

  1. Run nvm use 18.18.2
  2. Install wp-now globally, run npm i -g @wp-now/wp-now
  3. Start wp-now, run yarn wp-now

@adamwoodnz adamwoodnz marked this pull request as draft March 20, 2024 04:23
@ironnysh
Copy link

Hi @adamwoodnz, I tested this PR locally, and both the theme and plugins were activated.
However... :-)

  1. The bash script in /bin didn't run, so no content or database tables were imported.
  2. The build script required(?) for the theme also didn't run, so it's looks like a sad CSS Naked Day.

@sejas
Copy link

sejas commented Apr 1, 2024

I give it a try, and it seems to be in the right path! Pun intended. 🙌 .

Here is a recording of my testing. The first step I did is deleting the ~/.wp-now/wp-content/wp-content-***** so it starts like the first time. It deletes the database and is similar to running wp-now start --blueprint=../blueprint.json --reset.

I needed two runs for the learn-wporg theme to be activated. This can be related to the missing parent theme.

Other commands that are not captured are related to the building process of Learn itself like:

  • nvm use && yarn
  • yarn workspaces run build
learn-sensei.mp4

@adamwoodnz
Copy link
Contributor Author

Thanks for testing @ironnysh @sejas!

@adamziel
Copy link
Contributor

adamziel commented Apr 2, 2024

Blueprints should work under Node 18 – perhaps Node 20 isn’t needed here?

@adamwoodnz adamwoodnz self-assigned this Apr 2, 2024
@adamwoodnz adamwoodnz added the [Component] Environment Website development issues related to Learn's local environment, or needs Meta team involvement. label Apr 2, 2024
@adamwoodnz
Copy link
Contributor Author

Blueprints should work under Node 18 – perhaps Node 20 isn’t needed here?

It seems Node 20 is required for blueprint files

yarn wp-now                                                                                                                                      ✔  6745  12:12:13
yarn run v1.22.19
$ (cd wp-content && wp-now start --blueprint=../blueprint.json)
This script is requires node version v20.0.0 or above when --blueprint=<file> is used; found v18.16.0

@adamziel
Copy link
Contributor

adamziel commented Apr 2, 2024

@sejas That message could likely be removed now as all the required polyfills are in place.

@sejas
Copy link

sejas commented Apr 3, 2024

@adamziel , thanks for pointing that out.
I created the PR removing the message: WordPress/playground-tools#216

@adamziel
Copy link
Contributor

@adamwoodnz with WordPress/playground-tools#216 deployed, does the latest version of wp-now do the trick?

@adamwoodnz adamwoodnz force-pushed the try/wp-now branch 2 times, most recently from 41acb93 to 112c1c6 Compare April 17, 2024 04:58
@adamwoodnz
Copy link
Contributor Author

@adamwoodnz with WordPress/playground-tools#216 deployed, does the latest version of wp-now do the trick?

Getting closer! I've updated the description to use Node 18.18.2 now, which works with the blueprint file. After moving the themes to standard locations the TT4 theme error is gone.

We still have the issue with mu-plugins not being loaded, but the frontend loads as expected apart from that.

The admin loads but fairly quickly fatals, looks like db issues:

PHP Fatal error:  Uncaught RuntimeException: Unable to claim actions. Database error. in /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php:696
Stack trace:
#0 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php(588): ActionScheduler_wpPostStore->claim_actions('b44b395f2a8c77c...', 25, NULL, Array, '')
#1 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php(212): ActionScheduler_wpPostStore->stake_claim(25, NULL, Array, '')
#2 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueRunner.php(160): ActionScheduler_HybridStore->stake_claim(25)
#3 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueRunner.php(139): ActionScheduler_QueueRunner->do_batch(25, 'Async Request')
#4 /var/www/html/wp-includes/class-wp-hook.php(324): ActionScheduler_QueueRunner->run('Async Request')
#5 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#6 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#7 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php(52): do_action('action_schedule...', 'Async Request')
#8 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/lib/WP_Async_Request.php(177): ActionScheduler_AsyncRequest_QueueRunner->handle()
#9 /var/www/html/wp-includes/class-wp-hook.php(324): WP_Async_Request->maybe_handle('')
#10 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#11 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#12 /var/www/html/wp-admin/admin-ajax.php(188): do_action('wp_ajax_as_asyn...')
#13 {main}
  thrown in /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php on line 696

    at _NodePHP.run (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72937:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async #dispatchToPHP (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72470:14)
    at async PHPRequestHandler.request (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72385:14)
    at async PHPBrowser.request (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72170:22)
    at async file:///Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/main.js:1010:20 {
  output: {
    stdout: '<p>There has been a critical error on this website.</p><p><a href="https://wordpress.org/documentation/article/faq-troubleshooting/">Learn more about troubleshooting WordPress.</a></p>',
    stderr: 'WordPress database error <div style="clear:both">&nbsp;</div>\n' +
      '<div class="queries" style="clear:both;margin-bottom:2px;border:red dotted thin;">\n' +
      '<p>MySQL query:</p>\n' +
      '<p>SELECT locale FROM wporg_locales</p>\n' +
      '<p>Queries made or created this session were:</p>\n' +
      '<ol>\n' +
      '<li>Executing: BEGIN | (no parameters)</li>\n' +
      '<li>Executing: SELECT locale FROM wporg_locales | (no parameters)</li>\n' +
      '<li>Executing: ROLLBACK | (no parameters)</li>\n' +
      '</ol>\n' +
      '</div>\n' +
      '<div style="clear:both;margin-bottom:2px;border:red dotted thin;" class="error_message" style="border-bottom:dotted blue thin;">\n' +
      'Error occurred at line 3449 in Function <code>handle_error</code>. Error message was: SQLSTATE[HY000]: General error: 1 no such table: wporg_locales.\n' +
      '</div>\n' +
      '<p>Backtrace:</p>\n' +
      '<pre>#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()\n' +
      "#1 /var/www/html/wp-includes/class-wpdb.php(3107): WP_SQLite_DB->query('SELECT locale F...')\n" +
      "#2 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(104): wpdb->get_col('SELECT locale F...')\n" +
      '#3 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(54): WordPressdotorg\\LocaleDetection\\Detector->get_active_locales()\n' +
      '#4 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(24): WordPressdotorg\\LocaleDetection\\Detector->__construct()\n' +
      '#5 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(31): WordPressdotorg\\LocaleDetection\\init()\n' +
      "#6 /var/www/html/wp-settings.php(473): include_once('/var/www/html/w...')\n" +
      "#7 /var/www/html/wp-config.php(96): require_once('/var/www/html/w...')\n" +
      "#8 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')\n" +
      "#9 /var/www/html/wp-admin/admin-ajax.php(22): require_once('/var/www/html/w...')\n" +
      '#10 {main}</pre>\n' +
      " for query SELECT locale FROM wporg_locales made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/locale-detection/locale-detection.php'), WordPressdotorg\\LocaleDetection\\init, WordPressdotorg\\LocaleDetection\\Detector->__construct, WordPressdotorg\\LocaleDetection\\Detector->get_active_locales, WP_SQLite_DB->query, WP_SQLite_DB->print_error\n" +
      'WordPress database error <div style="clear:both">&nbsp;</div>\n' +
      '<div class="queries" style="clear:both;margin-bottom:2px;border:red dotted thin;">\n' +
      '<p>MySQL query:</p>\n' +
      "<p>UPDATE wp_posts SET post_password = 'b44b395f2a8c77ce0add', post_modified_gmt = '2024-04-17 04:46:01', post_modified = '2024-04-17 04:46:01' WHERE post_type = 'scheduled-action' AND post_status = 'pending' AND post_password = '' AND post_date_gmt <= '2024-04-17 04:46:01' ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC LIMIT 25</p>\n" +
      '<p>Queries made or created this session were:</p>\n' +
      '<ol>\n' +
      '<li>Executing: BEGIN | (no parameters)</li>\n' +
      '<li>Executing: UPDATE wp_posts SET post_password = :param0 , post_modified_gmt = :param1 , post_modified = :param2  WHERE post_type = :param3  AND post_status = :param4  AND post_password = :param5  AND post_date_gmt &lt;= :param6  ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC LIMIT 25 | parameters: b44b395f2a8c77ce0add, 2024-04-17 04:46:01, 2024-04-17 04:46:01, scheduled-action, pending, , 2024-04-17 04:46:01</li>\n' +
      '<li>Executing: ROLLBACK | (no parameters)</li>\n' +
      '</ol>\n' +
      '</div>\n' +
      '<div style="clear:both;margin-bottom:2px;border:red dotted thin;" class="error_message" style="border-bottom:dotted blue thin;">\n' +
      'Error occurred at line 3449 in Function <code>handle_error</code>. Error message was: SQLSTATE[HY000]: General error: 1 near "ORDER": syntax error.\n' +
      '</div>\n' +
      '<p>Backtrace:</p>\n' +
      '<pre>#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()\n' +
      "#1 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php(693): WP_SQLite_DB->query('UPDATE wp_posts...')\n" +
      "#2 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php(588): ActionScheduler_wpPostStore->claim_actions('b44b395f2a8c77c...', 25, NULL, Array, '')\n" +
      "#3 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php(212): ActionScheduler_wpPostStore->stake_claim(25, NULL, Array, '')\n" +
      '#4 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueRunner.php(160): ActionScheduler_HybridStore->stake_claim(25)\n' +
      "#5 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueRunner.php(139): ActionScheduler_QueueRunner->do_batch(25, 'Async Request')\n" +
      "#6 /var/www/html/wp-includes/class-wp-hook.php(324): ActionScheduler_QueueRunner->run('Async Request')\n" +
      "#7 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)\n" +
      '#8 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n' +
      "#9 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php(52): do_action('action_schedule...', 'Async Request')\n" +
      '#10 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/lib/WP_Async_Request.php(177): ActionScheduler_AsyncRequest_QueueRunner->handle()\n' +
      "#11 /var/www/html/wp-includes/class-wp-hook.php(324): WP_Async_Request->maybe_handle('')\n" +
      "#12 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)\n" +
      '#13 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n' +
      "#14 /var/www/html/wp-admin/admin-ajax.php(188): do_action('wp_ajax_as_asyn...')\n" +
      '#15 {main}</pre>\n' +
      " for query UPDATE wp_posts SET post_password = 'b44b395f2a8c77ce0add', post_modified_gmt = '2024-04-17 04:46:01', post_modified = '2024-04-17 04:46:01' WHERE post_type = 'scheduled-action' AND post_status = 'pending' AND post_password = '' AND post_date_gmt <= '2024-04-17 04:46:01' ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC LIMIT 25 made by do_action('wp_ajax_as_async_request_queue_runner'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Request->maybe_handle, ActionScheduler_AsyncRequest_QueueRunner->handle, do_action('action_scheduler_run_queue'), WP_Hook->do_action, WP_Hook->apply_filters, ActionScheduler_QueueRunner->run, ActionScheduler_QueueRunner->do_batch, ActionScheduler_HybridStore->stake_claim, ActionScheduler_wpPostStore->stake_claim, ActionScheduler_wpPostStore->claim_actions, WP_SQLite_DB->query, WP_SQLite_DB->print_error\n" +
      'PHP Fatal error:  Uncaught RuntimeException: Unable to claim actions. Database error. in /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php:696\n' +
      'Stack trace:\n' +
      "#0 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php(588): ActionScheduler_wpPostStore->claim_actions('b44b395f2a8c77c...', 25, NULL, Array, '')\n" +
      "#1 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php(212): ActionScheduler_wpPostStore->stake_claim(25, NULL, Array, '')\n" +
      '#2 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueRunner.php(160): ActionScheduler_HybridStore->stake_claim(25)\n' +
      "#3 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueRunner.php(139): ActionScheduler_QueueRunner->do_batch(25, 'Async Request')\n" +
      "#4 /var/www/html/wp-includes/class-wp-hook.php(324): ActionScheduler_QueueRunner->run('Async Request')\n" +
      "#5 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)\n" +
      '#6 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n' +
      "#7 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php(52): do_action('action_schedule...', 'Async Request')\n" +
      '#8 /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/lib/WP_Async_Request.php(177): ActionScheduler_AsyncRequest_QueueRunner->handle()\n' +
      "#9 /var/www/html/wp-includes/class-wp-hook.php(324): WP_Async_Request->maybe_handle('')\n" +
      "#10 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)\n" +
      '#11 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n' +
      "#12 /var/www/html/wp-admin/admin-ajax.php(188): do_action('wp_ajax_as_asyn...')\n" +
      '#13 {main}\n' +
      '  thrown in /var/www/html/wp-content/plugins/sensei-lms/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php on line 696\n'
  },
  source: 'request'
}
    at file:///Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/main.js:1017:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
PHP.run() output was: {
  stdout: '{"wp-auth-check":true,"server_time":1713329208}',
  stderr: 'WordPress database error <div style="clear:both">&nbsp;</div>\n' +
    '<div class="queries" style="clear:both;margin-bottom:2px;border:red dotted thin;">\n' +
    '<p>MySQL query:</p>\n' +
    '<p>SELECT locale FROM wporg_locales</p>\n' +
    '<p>Queries made or created this session were:</p>\n' +
    '<ol>\n' +
    '<li>Executing: BEGIN | (no parameters)</li>\n' +
    '<li>Executing: SELECT locale FROM wporg_locales | (no parameters)</li>\n' +
    '<li>Executing: ROLLBACK | (no parameters)</li>\n' +
    '</ol>\n' +
    '</div>\n' +
    '<div style="clear:both;margin-bottom:2px;border:red dotted thin;" class="error_message" style="border-bottom:dotted blue thin;">\n' +
    'Error occurred at line 3449 in Function <code>handle_error</code>. Error message was: SQLSTATE[HY000]: General error: 1 no such table: wporg_locales.\n' +
    '</div>\n' +
    '<p>Backtrace:</p>\n' +
    '<pre>#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()\n' +
    "#1 /var/www/html/wp-includes/class-wpdb.php(3107): WP_SQLite_DB->query('SELECT locale F...')\n" +
    "#2 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(104): wpdb->get_col('SELECT locale F...')\n" +
    '#3 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(54): WordPressdotorg\\LocaleDetection\\Detector->get_active_locales()\n' +
    '#4 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(24): WordPressdotorg\\LocaleDetection\\Detector->__construct()\n' +
    '#5 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(31): WordPressdotorg\\LocaleDetection\\init()\n' +
    "#6 /var/www/html/wp-settings.php(473): include_once('/var/www/html/w...')\n" +
    "#7 /var/www/html/wp-config.php(96): require_once('/var/www/html/w...')\n" +
    "#8 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')\n" +
    "#9 /var/www/html/wp-admin/admin-ajax.php(22): require_once('/var/www/html/w...')\n" +
    '#10 {main}</pre>\n' +
    " for query SELECT locale FROM wporg_locales made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/locale-detection/locale-detection.php'), WordPressdotorg\\LocaleDetection\\init, WordPressdotorg\\LocaleDetection\\Detector->__construct, WordPressdotorg\\LocaleDetection\\Detector->get_active_locales, WP_SQLite_DB->query, WP_SQLite_DB->print_error\n"
}
Error: PHP.run() failed with exit code 255 and the following output: WordPress database error <div style="clear:both">&nbsp;</div>
<div class="queries" style="clear:both;margin-bottom:2px;border:red dotted thin;">
<p>MySQL query:</p>
<p>SELECT locale FROM wporg_locales</p>
<p>Queries made or created this session were:</p>
<ol>
<li>Executing: BEGIN | (no parameters)</li>
<li>Executing: SELECT locale FROM wporg_locales | (no parameters)</li>
<li>Executing: ROLLBACK | (no parameters)</li>
</ol>
</div>
<div style="clear:both;margin-bottom:2px;border:red dotted thin;" class="error_message" style="border-bottom:dotted blue thin;">
Error occurred at line 3449 in Function <code>handle_error</code>. Error message was: SQLSTATE[HY000]: General error: 1 no such table: wporg_locales.
</div>
<p>Backtrace:</p>
<pre>#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()
#1 /var/www/html/wp-includes/class-wpdb.php(3107): WP_SQLite_DB->query('SELECT locale F...')
#2 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(104): wpdb->get_col('SELECT locale F...')
#3 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(54): WordPressdotorg\LocaleDetection\Detector->get_active_locales()
#4 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(24): WordPressdotorg\LocaleDetection\Detector->__construct()
#5 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(31): WordPressdotorg\LocaleDetection\init()
#6 /var/www/html/wp-settings.php(473): include_once('/var/www/html/w...')
#7 /var/www/html/wp-config.php(96): require_once('/var/www/html/w...')
#8 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')
#9 /var/www/html/wp-admin/admin-ajax.php(22): require_once('/var/www/html/w...')
#10 {main}</pre>
 for query SELECT locale FROM wporg_locales made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/locale-detection/locale-detection.php'), WordPressdotorg\LocaleDetection\init, WordPressdotorg\LocaleDetection\Detector->__construct, WordPressdotorg\LocaleDetection\Detector->get_active_locales, WP_SQLite_DB->query, WP_SQLite_DB->print_error

    at _NodePHP.run (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72937:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async #dispatchToPHP (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72470:14)
    at async PHPRequestHandler.request (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72385:14)
    at async PHPBrowser.request (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72170:22)
    at async file:///Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/main.js:1010:20 {
  output: {
    stdout: '{"wp-auth-check":true,"server_time":1713329208}',
    stderr: 'WordPress database error <div style="clear:both">&nbsp;</div>\n' +
      '<div class="queries" style="clear:both;margin-bottom:2px;border:red dotted thin;">\n' +
      '<p>MySQL query:</p>\n' +
      '<p>SELECT locale FROM wporg_locales</p>\n' +
      '<p>Queries made or created this session were:</p>\n' +
      '<ol>\n' +
      '<li>Executing: BEGIN | (no parameters)</li>\n' +
      '<li>Executing: SELECT locale FROM wporg_locales | (no parameters)</li>\n' +
      '<li>Executing: ROLLBACK | (no parameters)</li>\n' +
      '</ol>\n' +
      '</div>\n' +
      '<div style="clear:both;margin-bottom:2px;border:red dotted thin;" class="error_message" style="border-bottom:dotted blue thin;">\n' +
      'Error occurred at line 3449 in Function <code>handle_error</code>. Error message was: SQLSTATE[HY000]: General error: 1 no such table: wporg_locales.\n' +
      '</div>\n' +
      '<p>Backtrace:</p>\n' +
      '<pre>#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()\n' +
      "#1 /var/www/html/wp-includes/class-wpdb.php(3107): WP_SQLite_DB->query('SELECT locale F...')\n" +
      "#2 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(104): wpdb->get_col('SELECT locale F...')\n" +
      '#3 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(54): WordPressdotorg\\LocaleDetection\\Detector->get_active_locales()\n' +
      '#4 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(24): WordPressdotorg\\LocaleDetection\\Detector->__construct()\n' +
      '#5 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(31): WordPressdotorg\\LocaleDetection\\init()\n' +
      "#6 /var/www/html/wp-settings.php(473): include_once('/var/www/html/w...')\n" +
      "#7 /var/www/html/wp-config.php(96): require_once('/var/www/html/w...')\n" +
      "#8 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')\n" +
      "#9 /var/www/html/wp-admin/admin-ajax.php(22): require_once('/var/www/html/w...')\n" +
      '#10 {main}</pre>\n' +
      " for query SELECT locale FROM wporg_locales made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/locale-detection/locale-detection.php'), WordPressdotorg\\LocaleDetection\\init, WordPressdotorg\\LocaleDetection\\Detector->__construct, WordPressdotorg\\LocaleDetection\\Detector->get_active_locales, WP_SQLite_DB->query, WP_SQLite_DB->print_error\n"
  },
  source: 'request'
}
Trace: Error: PHP.run() failed with exit code 255 and the following output: WordPress database error <div style="clear:both">&nbsp;</div>
<div class="queries" style="clear:both;margin-bottom:2px;border:red dotted thin;">
<p>MySQL query:</p>
<p>SELECT locale FROM wporg_locales</p>
<p>Queries made or created this session were:</p>
<ol>
<li>Executing: BEGIN | (no parameters)</li>
<li>Executing: SELECT locale FROM wporg_locales | (no parameters)</li>
<li>Executing: ROLLBACK | (no parameters)</li>
</ol>
</div>
<div style="clear:both;margin-bottom:2px;border:red dotted thin;" class="error_message" style="border-bottom:dotted blue thin;">
Error occurred at line 3449 in Function <code>handle_error</code>. Error message was: SQLSTATE[HY000]: General error: 1 no such table: wporg_locales.
</div>
<p>Backtrace:</p>
<pre>#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()
#1 /var/www/html/wp-includes/class-wpdb.php(3107): WP_SQLite_DB->query('SELECT locale F...')
#2 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(104): wpdb->get_col('SELECT locale F...')
#3 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(54): WordPressdotorg\LocaleDetection\Detector->get_active_locales()
#4 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(24): WordPressdotorg\LocaleDetection\Detector->__construct()
#5 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(31): WordPressdotorg\LocaleDetection\init()
#6 /var/www/html/wp-settings.php(473): include_once('/var/www/html/w...')
#7 /var/www/html/wp-config.php(96): require_once('/var/www/html/w...')
#8 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')
#9 /var/www/html/wp-admin/admin-ajax.php(22): require_once('/var/www/html/w...')
#10 {main}</pre>
 for query SELECT locale FROM wporg_locales made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/locale-detection/locale-detection.php'), WordPressdotorg\LocaleDetection\init, WordPressdotorg\LocaleDetection\Detector->__construct, WordPressdotorg\LocaleDetection\Detector->get_active_locales, WP_SQLite_DB->query, WP_SQLite_DB->print_error

    at _NodePHP.run (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72937:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async #dispatchToPHP (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72470:14)
    at async PHPRequestHandler.request (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72385:14)
    at async PHPBrowser.request (/Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/node_modules/@php-wasm/node/index.cjs:72170:22)
    at async file:///Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/main.js:1010:20 {
  output: {
    stdout: '{"wp-auth-check":true,"server_time":1713329208}',
    stderr: 'WordPress database error <div style="clear:both">&nbsp;</div>\n' +
      '<div class="queries" style="clear:both;margin-bottom:2px;border:red dotted thin;">\n' +
      '<p>MySQL query:</p>\n' +
      '<p>SELECT locale FROM wporg_locales</p>\n' +
      '<p>Queries made or created this session were:</p>\n' +
      '<ol>\n' +
      '<li>Executing: BEGIN | (no parameters)</li>\n' +
      '<li>Executing: SELECT locale FROM wporg_locales | (no parameters)</li>\n' +
      '<li>Executing: ROLLBACK | (no parameters)</li>\n' +
      '</ol>\n' +
      '</div>\n' +
      '<div style="clear:both;margin-bottom:2px;border:red dotted thin;" class="error_message" style="border-bottom:dotted blue thin;">\n' +
      'Error occurred at line 3449 in Function <code>handle_error</code>. Error message was: SQLSTATE[HY000]: General error: 1 no such table: wporg_locales.\n' +
      '</div>\n' +
      '<p>Backtrace:</p>\n' +
      '<pre>#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator->get_error_message()\n' +
      "#1 /var/www/html/wp-includes/class-wpdb.php(3107): WP_SQLite_DB->query('SELECT locale F...')\n" +
      "#2 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(104): wpdb->get_col('SELECT locale F...')\n" +
      '#3 /var/www/html/wp-content/plugins/locale-detection/class-detector.php(54): WordPressdotorg\\LocaleDetection\\Detector->get_active_locales()\n' +
      '#4 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(24): WordPressdotorg\\LocaleDetection\\Detector->__construct()\n' +
      '#5 /var/www/html/wp-content/plugins/locale-detection/locale-detection.php(31): WordPressdotorg\\LocaleDetection\\init()\n' +
      "#6 /var/www/html/wp-settings.php(473): include_once('/var/www/html/w...')\n" +
      "#7 /var/www/html/wp-config.php(96): require_once('/var/www/html/w...')\n" +
      "#8 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')\n" +
      "#9 /var/www/html/wp-admin/admin-ajax.php(22): require_once('/var/www/html/w...')\n" +
      '#10 {main}</pre>\n' +
      " for query SELECT locale FROM wporg_locales made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/locale-detection/locale-detection.php'), WordPressdotorg\\LocaleDetection\\init, WordPressdotorg\\LocaleDetection\\Detector->__construct, WordPressdotorg\\LocaleDetection\\Detector->get_active_locales, WP_SQLite_DB->query, WP_SQLite_DB->print_error\n"
  },
  source: 'request'
}
    at file:///Users/adamwood/.nvm/versions/node/v18.18.2/lib/node_modules/@wp-now/wp-now/main.js:1017:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

@adamziel
Copy link
Contributor

no such table: wporg_locales

What should create that table? An mu-plugin, by any chance?

@adamwoodnz
Copy link
Contributor Author

no such table: wporg_locales

What should create that table? An mu-plugin, by any chance?

Sorry should have looked more closely at that. We have a setup script which should create it. Could we use a blueprint to do something similar?

@adamwoodnz adamwoodnz mentioned this pull request Apr 23, 2024
@adamziel
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Environment Website development issues related to Learn's local environment, or needs Meta team involvement.
Projects
Status: Draft (PRs only)
Development

Successfully merging this pull request may close these issues.

None yet

4 participants