WordPress/wordpress-playground

[Database] Exported and hosted Playground site can't connect to Jetpack

adamziel opened this issue · 2 comments

When connecting a Playground site to Jetpack, the following error shows up:

CleanShot 2023-10-17 at 11 36 17@2x

@sergeymitr pointed out there must be some database issue in the Playground site:

Looks like the site experiences issues with the database.
The site gets registered successfully, but it’s unable to save the blog ID or connection token. Then it generates the URL to establish user connection, tries to load blog ID from the options and fails.
So it doesn’t seem to be a connection issue, rather inability to properly connect the site due to option saving issues.

Jetpack is a commercial plugin, but the error is likely related to the SQLite integration in WordPress Playground and may affect other plugins.

More info from @sergeymitr:


No fancy MySQL queries, it just doesn’t save the options.

I created a test plugin in playground/wp-content/plugins/save-options-test.php to test simple update_options() call, and it works for the non-playground install you have there, but doesn’t work for the playground:

Works fine:
https://charming-grasshopper.jurassic.ninja/wp-admin/?sm_test_save_option=1
https://charming-grasshopper.jurassic.ninja/wp-admin/?sm_test_get_option=1

Doesn’t work:
https://charming-grasshopper.jurassic.ninja/playground/wp-admin/?sm_test_save_option=1
https://charming-grasshopper.jurassic.ninja/playground/wp-admin/?sm_test_get_option=1

The code is pretty straightforward:

add_action( 'init', function() {
        if ( ! empty( $_GET['sm_test_save_option'] ) ) {
                $result = update_option( 'sm_test_option', 'test_value' );
                var_dump( $result );
                die();
        }

        if ( ! empty( $_GET['sm_test_get_option'] ) ) {
                var_dump( get_option( 'sm_test_option' ) );
                die();
        }
} );

Interestingly, I wasn't able to reproduce this with a local Playground, nor with a local wp-now installation. Maybe the problem is specific to an exported Playground instance?