vuestorefront / mage2vuestorefront

Magento to Vue-storefront datapump - synchronizes Products, Categories and Product-to-category links between your Magento2 API and NoSQL database of vue-storefront

Home Page:http://vuestorefront.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Erroneous 127.0.0.1:3000

hunterjamesio opened this issue · comments

I'm having a lot of connection errors in my output when running this, but I can't track down anywhere which might be causing this? Elastic search seems to be populating correctly and connection to the Magento API is fine.

2018-12-09T21:55:54.507Z - info: Product sub-stage 6: Geting product categories for BPCWBWS-B41
2018-12-09T21:55:54.507Z - info: Using category_ids binding for BPCWBWS-B41: 19,11,13
2018-12-09T21:55:54.508Z - info: Product sub-stages done for BPCWBWS-B41
2018-12-09T21:55:54.508Z - info: Importing 42 of 50 - [(495 - BPCWBWS-B41) Baby Parasol Compatible with Baby Weavers Scoot - Blue] with tsk = 1544392330439
2018-12-09T21:55:54.508Z - info: Tasks count = 7
{ Error: connect ECONNREFUSED 127.0.0.1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3000 }
debug: Response received.
2018-12-09T21:55:54.521Z - info: Product sub-stage 6: Geting product categories for BPCWBWB2T-HP6
2018-12-09T21:55:54.521Z - info: Using category_ids binding for BPCWBWB2T-HP6: 19,11,13
2018-12-09T21:55:54.522Z - info: Product sub-stages done for BPCWBWB2T-HP6
2018-12-09T21:55:54.522Z - info: Importing 43 of 50 - [(463 - BPCWBWB2T-HP6) Baby Parasol Compatible with Baby Weavers Baby 2 Twin - Hot Pink] with tsk = 1544392330439
2018-12-09T21:55:54.522Z - info: Tasks count = 6
{ Error: connect ECONNREFUSED 127.0.0.1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3000 }
debug: Response received.
2018-12-09T21:55:54.559Z - info: Product sub-stage 6: Geting product categories for BPCWBWC-LB16
2018-12-09T21:55:54.559Z - info: Using category_ids binding for BPCWBWC-LB16: 19,11,13
2018-12-09T21:55:54.560Z - info: Product sub-stages done for BPCWBWC-LB16
2018-12-09T21:55:54.560Z - info: Importing 44 of 50 - [(472 - BPCWBWC-LB16) Baby Parasol Compatible with Baby Weavers Citi - Light Blue] with tsk = 1544392330439
2018-12-09T21:55:54.560Z - info: Tasks count = 5
{ Error: connect ECONNREFUSED 127.0.0.1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3000 }
debug: Response received.
2018-12-09T21:55:54.561Z - info: Product sub-stage 6: Geting product categories for BPCWBWS-B37
2018-12-09T21:55:54.562Z - info: Using category_ids binding for BPCWBWS-B37: 19,11,13
2018-12-09T21:55:54.562Z - info: Product sub-stages done for BPCWBWS-B37
2018-12-09T21:55:54.562Z - info: Importing 45 of 50 - [(491 - BPCWBWS-B37) Baby Parasol Compatible with Baby Weavers Scoot - Black] with tsk = 1544392330439
2018-12-09T21:55:54.562Z - info: Tasks count = 4
{ Error: connect ECONNREFUSED 127.0.0.1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3000 }
debug: Response received.
debug: Calling API endpoint: GET https://fylo.store/rest/V1/configurable-products/BPCONF-006/children
debug: Response received.
2018-12-09T21:55:54.589Z - info: Product sub-stage 6: Geting product categories for BPCWBWCAIO-LB28
2018-12-09T21:55:54.589Z - info: Using category_ids binding for BPCWBWCAIO-LB28: 19,11,13
2018-12-09T21:55:54.590Z - info: Product sub-stages done for BPCWBWCAIO-LB28
2018-12-09T21:55:54.590Z - info: Importing 46 of 50 - [(483 - BPCWBWCAIO-LB28) Baby Parasol Compatible with Baby Weavers Condour All in One - Light Blue] with tsk = 1544392330439
2018-12-09T21:55:54.590Z - info: Tasks count = 3
{ Error: connect ECONNREFUSED 127.0.0.1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3000 }
debug: Response received.

The details I am using to connect are similar to this (private information removed):

export TIME_TO_EXIT=2000
export VS_INVALIDATE_CACHE_URL=http://dev.fylo.store/invalidate?key=hidden&tag=
export VS_INVALIDATE_CACHE=0
export PRODUCTS_SPECIAL_PRICES=true
export MAGENTO_CONSUMER_KEY=hidden
export MAGENTO_CONSUMER_SECRET=hidden
export MAGENTO_ACCESS_TOKEN=hidden
export MAGENTO_ACCESS_TOKEN_SECRET=hidden
export DATABASE_URL=https://aws-vpc-here.com
export REDIS_HOST=redis.host.is.here

echo 'Default store - in our case United States / en'
export MAGENTO_URL=https://fylo.store/rest

# node --harmony src/cli.js blocks
# node --harmony src/cli.js pages 
# node --harmony src/cli.js reviews
node --harmony src/cli.js categories --removeNonExistent=true --extendedCategories=true
node --harmony src/cli.js productcategories
node --harmony src/cli.js attributes --removeNonExistent=true
node --harmony src/cli.js taxrule --removeNonExistent=true
node --harmony src/cli.js products --removeNonExistent=true --partitions=1

Thanks!

Hmm, the only connection to 127.0.0.1:3000 is for clearing the cache:
https://github.com/DivanteLtd/mage2vuestorefront/blob/6d36b1c24612b557fb474441180e04cf57fef164/src/config.js#L14

It's probably because the config option is casted as string not as a boolean (as You have set it to 0)
https://github.com/DivanteLtd/mage2vuestorefront/blob/6d36b1c24612b557fb474441180e04cf57fef164/src/adapters/magento/product.js#L484

Can You try to fix it and create a Pull Request please?

Just using parseInt() will not work for boolean values true and false.

One way to support both booleans (true/false), integers and strings like "1" and "0" would be to use JSON.parse():

invalidateCache: JSON.parse(process.env.VS_INVALIDATE_CACHE) || false,

The above should work for the following settings:

VS_INVALIDATE_CACHE=0
VS_INVALIDATE_CACHE=1
VS_INVALIDATE_CACHE="0"
VS_INVALIDATE_CACHE="1"
VS_INVALIDATE_CACHE=false
VS_INVALIDATE_CACHE=true
VS_INVALIDATE_CACHE="false"
VS_INVALIDATE_CACHE="true"

Thanks @Cyclonecode, PR submitted.