skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. no need to change the package. you can do this:

    • add /index.php to the end of api.

    • set wpAPIPrefix to wp-json.

    • set query_string_auth to true (I,m not sure if this one necessary).

      {
        resolve: '@pasdo501/gatsby-source-woocommerce',
        options: {
          api: 'pro.com/index.php',
          https: true,
          verbose: true,
          api_keys: {
            consumer_key: `ck_...........`,
            consumer_secret: `cs_.................`,
          },
          fields: ['products', 'products/categories', 'products/attributes', 'products/tags'],
          wpAPIPrefix: 'wp-json',
          query_string_auth: true,
          api_version: 'wc/v3',
          // per_page: 100,
          // encoding: 'utf8',
          // axios_config: {}
        }
      }
      
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search