WordPress/wordpress-playground

Adding a product to Woocommerce creates a critical error

tomswales opened this issue · 6 comments

Issue

Adding a new product in Woocommerce causes critical error

System

Macbook Pro
MacOS 13.3.1
Browser Chrome Version 114.0.5735.198 (Official Build) (x86_64)

Replication

Playground code:

<!DOCTYPE html>
<html>

<head>
	<title>Woocommerce Playground</title>
    <meta charset="utf-8"  />
    <meta name="viewport" content="width=device-width">
</head>

<body>

    <iframe
        id="wp"
    ></iframe>

</body>

<script type="module">
    import { startPlaygroundWeb } from 'https://unpkg.com/@wp-playground/client/index.js';

    const client = await startPlaygroundWeb({
        iframe: document.getElementById('wp'),
        remoteUrl: `https://playground.wordpress.net/remote.html`,
        blueprint: {
            preferredVersions: {
                wp: '6.2',
                php: '8.0',
            },
            steps: [
                { step: 'login' },
                {
                    step: 'installPlugin',
                    pluginZipFile: {
                        resource: 'wordpress.org/plugins',
                        slug: 'woocommerce',
                    },
                }
            ],
        },
    });
    await client.isReady();
</script>

<style>
    body {
        margin:0;
        padding: 0;
    }

    iframe {
        width: 100vw; height: 100vh; border: none;
    }
</style>
</html>

When wordpress is loaded, then:

  • Go to "My Website details"
Screenshot 2023-07-17 at 15 36 26
  • When flow for setting up store details appears, skip it
Screenshot 2023-07-17 at 15 37 55
  • Go to add products and follow flow for physical products
Screenshot 2023-07-17 at 15 38 33
  • Add product details and press Publish
Screenshot 2023-07-17 at 15 41 55
  • Should see this error message
Screenshot 2023-07-17 at 15 42 25

Error text

Warning: require(/wordpress/wp-includes/post.php): Failed to open stream: No such file or directory in /wordpress/wp-settings.php on line 2

Fatal error: Uncaught Error: Failed opening required '/wordpress/wp-includes/post.php' (include_path='.:') in /wordpress/wp-settings.php:2 Stack trace: #0 /wordpress/wp-config.php(11): require_once() #1 /wordpress/wp-load.php(2): require_once('/wordpress/wp-c...') #2 /wordpress/wp-admin/admin.php(2): require_once('/wordpress/wp-l...') #3 /wordpress/wp-admin/post.php(2): require_once('/wordpress/wp-a...') #4 {main} thrown in /wordpress/wp-settings.php on line 2
There has been a critical error on this website.

From the last screenshot, apparently the error is that the file wp-includes/post.php is missing. I wonder how that could happen.

As a comparison, I followed the above steps and wasn't able to reproduce the issue on Ubuntu 22.04, Firefox and Chromium. But the issue doesn't seem like it would be specific to the operating system or browser.

I also tried on a regular Playground instance without the client, from:

https://playground.wordpress.net/?plugin=woocommerce

And was able to create a product successfully.


Are you able to reproduce this issue reliably every time?

Also, is there any JavaScript error in the browser dev console?

Are you able to reproduce this issue reliably every time?

Yes, every time, both with client on localhost and in the regular Playground instance using https://playground.wordpress.net/?plugin=woocommerce

Also, is there any JavaScript error in the browser dev console?

Yes, there is an error:
Uncaught TypeError: s.toLowerCase is not a function at should_fill_on_click (VM163 onloadwff.js:71:579116) at VM163 onloadwff.js:71:144177

Screenshot 2023-07-18 at 14 40 06

Thank you for the details, that's helpful information. Since I'm not seeing the error on my side with multiple browsers on Linux, I guess it could be specific to the operating system. Does it happen on Safari?

From the screenshot, it looks like a script inside the embedded site throws an error, which somehow causes (or appears to cause) a corruption in the virtual file system of the Playground.

Yes, also happens on Safari, exactly the same behaviour...

I wonder if that's the same issue as #603. I suspect faulty deployment and both were filled around the same date.

@tomswales can you still reproduce the problem? What if you clear the browser cache?

I'm closing this one. @tomswales If this happens up again please drop a comment and I'll reopen.