Gatsby / WooCommerce not processing mediaItems - wordpress

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:
--
gatsby-source-wordpress Error category: undefined
Error:
Internal server error
Debug message:
in_array(): Argument #2 ($haystack) must be of type array, string given
Error path: mediaItems
info gatsby-source-wordpress GraphQL vars: {"first":100,"url":"http://178.62.90.26/graphql","in":["13"],"after":null}
--
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:
--
resolve: 'gatsby-source-wordpress',
options: {
url: process.env.WPGRAPHQL_URL || 'http://178.62.90.26/graphql',
type: {
ShippingMethod: {
exclude: true
},
},
debug: {
graphql: {
showQueryVarsOnError: true,
showQueryOnError: true,
onlyReportCriticalErrors: false,
},
},
},
--
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:
--
gatsby-source-wordpress Error category: undefined
Error:
Internal server error
Debug message:
in_array(): Argument #2 ($haystack) must be of type array, string given
Error path: mediaItems
info gatsby-source-wordpress GraphQL vars: {"first":100,"url":"http://178.62.90.26/graphql","in":["13"],"after":null}
--
And it creates 0 MediaItem nodes:
no MediaItems processed
And in my debug.log it’s just this over and over again:
--
[05-Jan-2023 10:21:40 UTC] PHP Deprecated: Function WPGraphQL\Connection\TermObjects::get_connection_args is <strong>deprecated</strong> since version 1.13.0! Use \WPGraphQL\Type\Connection\TermObjects::get_connection_args instead. in /var/www/html/wp-includes/functions.php on line 5379
[05-Jan-2023 10:21:40 UTC] PHP Deprecated: Function WPGraphQL\Connection\Comments::get_connection_config is <strong>deprecated</strong> since version 1.13.0! Use \WPGraphQL\Type\Connection\Comments::get_connection_config instead. in /var/www/html/wp-includes/functions.php on line 5379
--
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

Related

Could’nt install plugins in wordpress

I’m using wordpress.org- “oceanWp theme” and i’ve installed a plugin called “profile builder” then removed and tried to install it again, but I couldn’t.
As soon as I give install it loads and says “Update Failed!”.
ERROR MSG: “Installation failed: Abort class-pclzip.php : Missing zlib extensions”.
I also edited the file wp-admin/includes/class.pclzip.php and Changed all references of gzopen to gzopen64(had 3 references) but didn’t help.
I know I still can install plugins via Cpanel and filezila but I really want to solve this ERROR.
Thanks in advance:)
Host: Infinityfree.net
Wordpress version: Version 5.4.2
Profile builder plugin version: Version: 3.1.9
The page I need help with: https://makeitquick.ml

Gatsby-Source-Wordpress configuration

Gatsby-Source-WordPress
Gatsby Develop
returns:
"The server response was "404 Not Found"
Running Gatsby default Starter
Fresh install of wordpress all on localhost.
wordpress is here: localhost/freshinstall
I see json data here: localhost/freshinstall/wp-json/
Permalinks in wordpress set to: Post Name
gatsby-source-wordpress is the only plugin installed in gatsby:
{
resolve: `gatsby-source-wordpress`,
options: {
// your wordpress source
baseUrl: `localhost/freshinstall`,
protocol: `http`,
hostingWPCOM: false,
useACF: true
}
},
Expecting to be able to access information in wordPress.
The following is what I see:
my-default-starter dk$ gatsby develop
success open and validate gatsby-configs - 0.067 s
success load plugins - 42.771 s
success onPreInit - 0.034 s
success initialize cache - 0.061 s
success copy gatsby files - 2.423 s
success onPreBootstrap - 0.052 s
Path: /freshinstall/wp-json
The server response was "404 Not Found"
ERROR
Plugin gatsby-source-wordpress returned an error Cannot read property 'data' of undefined
TypeError: Cannot read property 'data' of undefined
- fetch.js:134 fetch
[my-default-starter]/[gatsby-source-wordpress]/fetch.js:134:21
- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7
warn The gatsby-source-wordpress plugin has generated no Gatsby nodes. Do you need it?
success source and transform nodes - 1.840 s
success building schema - 1.270 s
success createPages - 0.007 s
success createPagesStatefully - 1.266 s
success onPreExtractQueries - 0.089 s
success update schema - 0.078 s
success extract queries from components - 25.299 s
success write out requires - 0.165 s
success write out redirect data - 0.044 s
success Build manifest and related icons - 0.402 s
success onPostBootstrap - 0.458 s
⠀
info bootstrap finished - 269.881 s
⠀
success Generating image thumbnails — 6/6 - 2.762 s
success run static queries - 3.311 s — 3/3 0.91 queries/second
success run page queries - 0.077 s — 5/5 93.18 queries/second
DONE Compiled successfully in 105741ms 3:25:50 PM
⠀
You can now view gatsby-starter-default in the browser.
⠀
http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
http://localhost:8000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use npm run build
⠀
ℹ 「wdm」:
ℹ 「wdm」: Compiled successfully.
Turns out my own machine was messed up.
It took forever to resolve, what ultimately solved the issue was changing how apache was setup on the machine. The link localhost/domain wasn't literally what it was. I broke apache, broke mysql, then fixed both then had to change a port and finally it works like this now:
localhost:8888/domain
Everything in Gatsby-Source-WordPress worked after that.
I stumbled on this same problem and here are the things I did:
My MAMP settings had the default port as 80. Local Wordpress could be accessed through http://localhost. I reverted MAMP ports to default, so the local url became http://localhost:8888/your domain name if applied
I forced stop sqld which was running concurrently on my Mac.
I went to phpMyAdmin and disabled all the active plugins.
I went to wp-admin and reset permalinks to post name. That had already been set as post name, but still click the Save button anyway to commit the change.
Looking back, I have no idea what was the culprit, but hope this helps someone.
Hey your config should look like this but if not let me know and i'll fix :).
{
resolve: `gatsby-source-wordpress`,
options: {
baseUrl: process.env.API_URL,
protocol: process.env.API_PROTOCOL,
hostingWPCOM: false,
useACF: true,
includedRoutes: [
"**/categories",
"**/posts",
"**/pages",
"**/media",
"**/tags",
"**/taxonomies",
"**/users",
"**/menus",
"**/portfolio",
"**/services",
"**/qualifications",
"**/gallery",
"**/logo",
"**/location",
],
},
},
}

WooCommerce 302 redirect to homepage after checkout is finished

I have an unusual error I don't seem able to fix myself ... I have a WordPress website, with WooCommerce as shop-part of the site. Today I noticed, that after I make an order, (Select product > Add to cart > Proceed to Checkout ) after I fulfill the order-form, choose the payment and click "FINISH ORDER" ... I don't see the "Thank you for your order", with order details, but instead, I get automatically redirected to homepage via 302 redirection.
I tried to switch themes back to TwentySeventeen - not working.
I reverted .htaccess back to "original" WordPress one - not working.
I deleted quite a lot of the plugins website normaly uses - not working.
I removed whole CDN integration - not working.
For some unknown reason, "thank-you-page" redirects via 302 redirection back to homepage.
The order is processed and customers get e-mail notification properly, it's just that thank you page (where order details should be seen) isn't loaded.
I already checked this Stack question - but I don't have the "Force the HTTP after checkout" option within WooCommerce Dashboard.
You can see the "Network" part of Dev Tools here:
Image 1: https://prnt.sc/lnbqcs
Image 2: https://prnt.sc/lnbq5o
Image 3: https://prnt.sc/lnbqqj
This is the System report:
WC Version: 3.5.1
Log Directory Writable: ✔
WP Version: 4.9.8
WP Multisite: –
WP Memory Limit: 1 GB
WP Debug Mode: –
WP Cron: –
Language: sl_SI
External object cache: –
Server Environment
Server Info: Apache
PHP Version: 7.0.32
PHP Post Max Size: 64 MB
PHP Time Limit: 900
PHP Max Input Vars: 20000
cURL Version: 7.60.0
OpenSSL/1.0.2k
SUHOSIN Installed: –
MySQL Version: 10.0.37-MariaDB
Max Upload Size: 64 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
Please try to help me ... I'm stuck here for the past 3 hrs and didn't figure it out (today) ... Much appreciated!
Thank you,
T.

Avada Wordpress wp_remote_get()

Hello All I am at a loss of what to do on our word press site it is saying
wp_remote_get() failed. Some theme features may not work. Please
contact your hosting provider and make sure that
https://build.envato.com/api/ is not blocked.
So I have contacted Avada and they said to make sure it is not blocked I have checked with our system admin twice and it is not blocked and he added to our exceptions list to make sure it can go through. I am still getting the error New to word press and Avada and not sure what I need to do next.
System Status from Wordpress and Avada
Avada Versions:
Avada Versions
Current Version: 5.4.2
Previous Version: 5.4.0 5.4.1 5.4.2
WordPress Environment
Home URL: http://landoll.com
Site URL: http://landoll.com
WP Content Path: /var/www/html/wp-content
WP Path: /var/www/html/
WP Version: 4.9.5
WP Multisite: –
PHP Memory Limit: 256 MB
WP Debug Mode: –
Language: en_US
Server Environment
Server Info: Apache/2.4.18 (Ubuntu)
PHP Version: 7.0.28-0ubuntu0.16.04.1. WordPress recommendation: 7.2 or above.
See WordPress Requirements for details.
PHP Post Max Size: 35 MB
PHP Time Limit: 0
PHP Max Input Vars: 3000 - Recommended Value: 4940.Max input vars limitation
will truncate POST data such as menus. See: Increasing max input vars limit.
SUHOSIN Installed: –
ZipArchive: ✔
MySQL Version: 5.7.22
Max Upload Size: 35 MB
DOMDocument: ✔
WP Remote Get: wp_remote_get() failed. Some theme features may not work. Please contact your hosting provider and make sure that https://build.envato.com/api/ is not blocked.
WP Remote Post: ✔
GD Library: 2.1.1
Active Plugins (25)
Advanced iFrame: by Michael Dempfle
ARVE Advanced Responsive Video Embedder: by Nicolas Jonas
All-in-One WP Migration: by ServMask
Enable Media Replace: by ShortPixel
Enhanced Media Library PRO: by wpUXsolutions
File Manager Advanced Shortcode: by modalweb
File Manager Advanced: by modalweb
Formidable Forms Pro: by Strategy11
Formidable Forms: by Strategy11
Fusion Builder: by ThemeFusion
Fusion Core: by ThemeFusion
Gallery: by Total-Soft
Head and Footer Scripts Inserter: by Space X-Chimp
Post Types Order: by Nsp Code
Slider Revolution: by ThemePunch
Search Exclude: by Roman Pronskiy
SMTP Mailer: by naa986
Team Showcase: by Carlos Moreira
UpdraftPlus - Backup/Restore: by UpdraftPlus.Com
DavidAnderson
Yoast SEO: by Team Yoast
WP Rocket: by WP Media
WP Smush: by WPMU DEV
WP Store Locator - CSV Manager: by Tijmen Smit
WP Store Locator: by Tijmen Smit
wpDataTables: by TMS-Plugins
I just had this issue with Avada Theme.
Installing php-curl extension, fix the job. Basically, I think
behind the scene it uses curl to communicate with other endpoints.
But they should be given a warning like Curl is not installed, something like they are done for GD, ZipArchive etc.

Kong refuses to recognise custom plugin as enabled

I was developing a Custom plugin for Kong.
To start off I followed guidelines listed in this tutorial
http://streamdata.io/blog/developing-an-helloworld-kong-plugin/
Few changes that I made along the way were changing dependency in the rockspec file for "lrexlib-pcre" from version 2.8.0-1 to 2.7.2-1 due to compilation problems that I faced with 2.8.0-1 version.
Please note that I am working in the next branch. The master branch has version 2.7.2-1 listed.
The tutorial assumes Kong version 0.4.2-1 while I am working with Kong version 0.5.2-1.
I have listed my plugin in kong.yml. Last listed is helloworld plugin
plugins_available:
- ssl
- jwt
- acl
- cors
- oauth2
- tcp-log
- udp-log
- file-log
- http-log
- key-auth
- hmac-auth
- basic-auth
- ip-restriction
- mashape-analytics
- request-transformer
- response-transformer
- request-size-limiting
- rate-limiting
- response-ratelimiting
- helloworld
I have listed the helloworld files in rockspec file at the last.
["kong.plugins.helloworld.handler"] =
"kong/plugins/helloworld/handler.lua",
["kong.plugins.helloworld.access"] = "kong/plugins/helloworld/access.lua",
["kong.plugins.helloworld.schema"] = "kong/plugins/helloworld/schema.lua"
Compilation is successful but kong refuses to list helloworld plugin as available in the node. All other builtin plugins are shown as available in the server
I tried enabling the plugin anyway with mock api. It doesn't work as expected and trying to restart kong lists error
nginx: [error] [lua] init_by_lua:5: Startup error:
/usr/local/share/lua/5.1/kong.lua:82: You are using a plugin that has
not been enabled in the configuration: helloworld [INFO] dnsmasq
stopped [ERR] Could not start Kong
I know there were some breaking changes introduced in Kong version 0.5. I followed the changelog, but I found nothing that would help.
Am i missing a setting a configuration somewhere?
Any help would be appreciated.
Try the following in your kong.yml:
custom_plugins:
- helloworld
I fixed this issue by adding things in custom_plugins and lua_package_path.
Here are the steps to enable and use custom plugin in kong Env.
1 - Add custom plugin name in --- custom_plugins = hello-world
2 - Install hello-world plugin by using following steps ---
If you have source code of your plugin then move into it and execute the command --- "luarocks make"
it will install your plugin.
now you have to execute a command "make install-dev" make sure your plugin have makefile like as --
Once you execute this command "make install-dev". it will create lua file at a location something like that -
/your-plugin-path/lua_modules/share/lua/5.1/kong/plugins/your-plugin-name/?.lua
just copy this path and add it into the kong configuration file in lua_package_path
Something like that --
lua_package_path=/your-plugin-path/lua_modules/share/lua/5.1/kong/plugins/your-plugin-name/?.lua
Now you done your job.
Just start kong -- kong start --vv
You will see that the plugin loaded into kong plugin env.
#Enjoy

Resources