wordpresswoocommercegatsbywoocommerce-rest-apigatsby-plugin

Error: connect ECONNREFUSED 127.0.0.1:8080


I am using wordpress website Local by flywheel ( url: xyz.local ) . I created a new gatsby site using and added gatsby-source-woocommerce. I also generated consumer key and consumer secret from woo-commerce settings. i added them to the api_keys in the config file.

When i run gastby develop, i get this error.

========== WARNING FOR FIELD products ===========
The following error status was produced: Error: connect ECONNREFUSED 127.0.0.1:8080
================== END WARNING ==================

08:19:23.204Z > gatsby-source-woocommerce: Fetching 0 nodes for field: products
08:19:23.206Z > gatsby-source-woocommerce: Completed fetching nodes for field: products
warn
========== WARNING FOR FIELD products/categories ===========
The following error status was produced: Error: connect ECONNREFUSED 127.0.0.1:8080
================== END WARNING ==================

08:19:23.213Z > gatsby-source-woocommerce: Fetching 0 nodes for field: products/categories
08:19:23.215Z > gatsby-source-woocommerce: Completed fetching nodes for field: products/categories
warn
========== WARNING FOR FIELD products/attributes ===========
The following error status was produced: Error: connect ECONNREFUSED 127.0.0.1:8080
================== END WARNING ==================

Can someone pls say if did i miss anything? or any wrong i have done?


Solution

  • I solved it. Problem is with plugin. In config options of gatsby-source-woocommerce, comment everything after fields i.e After commenting it looks like,

    {
          resolve: "@pasdo501/gatsby-source-woocommerce",
          options: {
    
            // Base URL of Wordpress site
    
            api: "wordpress.domain",
    
            // set to false to not see verbose output during build
            // default: true
            verbose: true,
    
            // true if using https. otherwise false.
            https: false,
            api_keys: {
              consumer_key: <key>,
              consumer_secret: <secret>,
            },
            // Array of strings with fields you'd like to create nodes for...
            fields: ["products", "products/categories", "products/attributes"],
    
           
          },
        },
    

    Head to the @pasdo501/gatsby-source-woocommerce folder ( node modules ) -> gatsby-node.js change api_version = "wc/v3" to "wc/v2" and change wpAPIPrefix = null to "wp-json" and save it.

    voila