Open Steppio opened 1 year ago
I'm also having issues with this. Works perfectly without WC plugin but as soon as I add it, it no longer sees any media items including pages, posts, and products. I'm running Wordpress through Local by Flywheel and the gatsby development server.
I am having this issue as well, and can reproduce it easily on my machine with a fresh Gatsby V5 starter and a wordpress instance with one dummy product. As soon I enable WooCommerce I get the same error: in_array(): Argument #2 ($haystack) must be of type array, string given
I can query these featured images on wordpress' GraphQL client too no problem.
I'm not sure what combination of plugins in both gatsby and wordpress is considered stable, but if anyone has a working repo I would greatly appreciate it.
I'm also having issues with this. Works perfectly without WC plugin but as soon as I add it, it no longer sees any media items including pages, posts, and products. I'm running Wordpress through Local by Flywheel and the gatsby development server.
Hi Jon-Hudak - are you using a AWS / Digital Ocean server by any chance? I've tested on a brand spanking new install on both of these and it's the same issue - it just won't build the mediaItems nodes.
Today I'm going to try the same approach using a local server just to rule out the possibility of it being something on the AWS / Digital Ocean end
@Steppio @Jon-Hudak @Hazmatyre Sorry for the delayed response, I'm not experienced with Gatsby and actively avoided using it for awhile now. I'll investigate more and see if I can get a solution pushed.
But please note, there is a chance the issue is with WP-Gatsby and not WooGraphQL.
Hi @kidunot89 - I've tried a huge variation of plugins versions etc, and last night I had a breakthrough - downgrading my version of PHP 8+ to 7.4 fixed the issue completely. Version 7.4 is no longer supported, but I can confirm it does work.
I will list out the WP / npm plugin versions I am using in a separate comment when I get back to my computer for future reference.
I can confirm that PHP 7.4 works with the following plugins:
Wordpress plugin versions
WPGraphQL WooCommerce (WooGraphQL) Version 0.12.0
WP GraphQL Version 1.13.7
WP Gatsby Version 2.3.3
WooCommerce Version 6.9.4
NPM versions:
@pasdo501/gatsby-source-woocommerce ^0.17.2
gatsby ^4.23.0,
gatsby-link 4.23.0,
gatsby-plugin-image ^2.23.0,
gatsby-plugin-manifest ^4.0.0,
gatsby-plugin-offline ^5.0.0,
gatsby-plugin-sitemap ^5.12.1,
gatsby-source-filesystem ^4.23.0
gatsby-source-wordpress ^7.4.1
react ^18.1.0
react-dom ^18.1.0
If anyone is stuck on the same issue and needs any more information please let me know, thanks.
@Steppio I patched the errors you were receive here, and the solution is available on the develop
branch right now and will be in the next release.
@Steppio @Hazmatyre @Jon-Hudak Can anyone confirm if this issue has been resolve in v0.12.1
?
I'm having major problems trying to build a Gatsby / WooCommerce site - whenever wp-graphql-woocommerce is activated it simply will not process any media items, with this error:
--
--
Steps to reproduce:
I have created a completely fresh install of Wordpress (v6+) on a php8+ environment (Digital Ocean Wordpress 1 click install image)
https://marketplace.digitalocean.com/apps/wordpress
I open the console and finish the wordpress installation process
Next I install wp-graphql (latest master version) and run composer install in the directory, then activate the plugin
Next I install WooCommerce, run through the installation process and create a dummy product
Then I install WP-Gatsby (v2.3.3) and activate.
Next I install the latest version of wp-graphql-woocommerce (v12 master), upload the plugin and activate I then change the permalink structure and check that the /graphql route is working - everything is fine
At this point I have a single dummy product, a single Hello World post with a featured image attached, and I have only the following plugins installed on the site:
WooCommerce (v7.2.2)
WP Gatsby (v2.3.3)
WP GraphQL (v1.13.7)
WPGraphQL WooCommerce (WooGraphQL) (v0.12.0)
I then clone this simple blog repo: https://github.com/gatsbyjs/gatsby-starter-wordpress-blog.git
I run yarn install for dependencies.
I change my gatsby-config to point toward my server and add an option in gatsby-source-wordpress to ignore ShippingMethod (or else it takes forever to build), and add some debugging in to help define the issue:
--
--
I then add define( 'GRAPHQL_DEBUG', true ); to my wp-config.php and restart Apache just to be sure
I then run gatsby develop and get the error I mentioned earlier when it gets to MediaItems:
--
--
And it creates 0 MediaItem nodes:
no MediaItems processed
And in my debug.log it’s just this over and over again:
--
--
If I deactivate wp-graphql-woocommerce the image is processed absolutely fine and creates the one mediaItem node that I have:
MediaItems processed with wp-graphql-woocommerce disabled
I need the woocommerce aspect of things though so this isn’t a solution. It just seems to happen whenever wp-graphql-woocommerce is activated.
Any help with this would be hugely, hugely appreciated as I’ve been banging my head against a brick wall for a while now and I'm really starting to worry that this isn't going to work
I have tried the following versions of wp-graphql / wp-graphql-woocommerce
wp-graphql - v1.12.2, v1.12.3, v1.13.0, v1.13.4, v1.13.7
wp-graphql-woocommerce - v12, v11.2, v10.7
Node Versions - v16.11.1, v18.12.1
I've tried with both Digital Ocean and AWS Lightsail servers - same outcome
And it just never seems to process the mediaItems. The strangest thing is that this did work in September, however lately it just flatly refuses to process the images whilst wp-graphql-woocommerce is activated