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

Add ElasticSearch support

pkarw opened this issue · comments

Already added :)

Hi,
I tried to run this command after the npm install finished correctly:
node --harmony cli.js fullreindex
but there was this error:
error: Error: Cannot find module 'elasticsearch'
I fixed it calling
npm install elasticsearch
could you please share your version of elasticsearch? I have 13.3.1 added right now.

Best regards,
Mirko

Hi mirko,

I've just added missing dependency to the package.json nad now it seems to work. Here what I've done on clear installation:

MacBook-Pro-Piotr-2:mage2nosql pkarwatka$ cd src/
MacBook-Pro-Piotr-2:src pkarwatka$ git pull
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/DivanteLtd/mage2nosql
   af6a31f..e1f2f81  master     -> origin/master
Updating af6a31f..e1f2f81
Fast-forward
 src/package.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
MacBook-Pro-Piotr-2:src pkarwatka$ npm install
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN magentosync@1.0.0 No repository field.

added 311 packages in 11.667s


   ╭─────────────────────────────────────╮
   │                                     │
   │   Update available 5.4.1 → 5.4.2    │
   │     Run npm i -g npm to update      │
   │                                     │
   ╰─────────────────────────────────────╯

MacBook-Pro-Piotr-2:src pkarwatka$ node --harmony cli.js fullreindex
2017-10-03T06:57:53.496Z - debug: Elasticsearch module initialized!
info: Winston logging library initialized.
2017-10-03T06:57:53.962Z - info: Connected correctly to server
2017-10-03T06:57:53.962Z - info: TRANSACTION KEY = 1507013873932
debug: Calling API endpoint: GET http://magento2.demo-1.divante.pl/rest//V1/categories
2017-10-03T06:57:53.989Z - debug: Elasticsearch module initialized!
2017-10-03T06:57:53.989Z - info: Connected correctly to server
2017-10-03T06:57:53.989Z - info: TRANSACTION KEY = 1507013873989
debug: Calling API endpoint: GET http://magento2.demo-1.divante.pl/rest//V1/categories
debug: Response received.
error: API call failed: HTTP ERROR undefined
2017-10-03T06:57:54.270Z - error: HTTP ERROR undefined
2017-10-03T06:57:54.271Z - info: Cleaning up with tsk = 1507013873932
2017-10-03T06:57:54.276Z - error: No items given to processItems call!
debug: Response received.
error: API call failed: HTTP ERROR undefined
2017-10-03T06:57:54.280Z - error: HTTP ERROR undefined
2017-10-03T06:57:54.280Z - info: Renaming the cache key to production! 
2017-10-03T06:57:54.280Z - info: Publishing cache keys to production finished!
2017-10-03T06:57:54.281Z - debug: Stepping to next action
2017-10-03T06:57:54.281Z - error: No items given to processItems call!
2017-10-03T06:57:54.281Z - info: Starting full products reindex!
2017-10-03T06:57:54.283Z - debug: Elasticsearch module initialized!
2017-10-03T06:57:54.283Z - info: Running in MPM (Multi Process Mode) with partitions count = 4
object
debug: Calling API endpoint: GET http://magento2.demo-1.divante.pl/rest//V1/products?searchCriteria=&searchCriteria[currentPage]=1&searchCriteria[pageSize]=1
debug: Response received.
error: API call failed: HTTP ERROR undefined
2017-10-03T06:57:54.382Z - error: Unhandled Rejection at: Promise Promise {
  <rejected> Error: HTTP ERROR undefined
    at /Users/pkarwatka/Downloads/mage2nosql/src/adapters/magento/product.js:62:15
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) } reason: Error: HTTP ERROR undefined
    at /Users/pkarwatka/Downloads/mage2nosql/src/adapters/magento/product.js:62:15
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
2017-10-03T06:57:55.486Z - info:  
{ took: 620,
  timed_out: false,
  total: 39,
  deleted: 39,
  batches: 1,
  version_conflicts: 0,
  noops: 0,
  retries: { bulk: 0, search: 0 },
  throttled_millis: 0,
  requests_per_second: -1,
  throttled_until_millis: 0,
  failures: [] }
^C

Nevermind the "ERROR" messages - it's because I've not properly configured Magento endpoints.

@mirkocesaro please let me know if this last comment has helped?

Hi @pkarw , now it works correctly.
I think that is better to set a version inside the package.json for elasticsearch, just to be sure that in the feature all works well :)

Thank you for your help.
Mirko

OK, could you please set the version for the latest and prepare PR?

Would be also great to learn something on the project that you're using mage2nosql for. Could you expand sth on that? Contact to me in any case: pkarwatka@divante.co

Hi mirko,

I've just added missing dependency to the package.json nad now it seems to work. Here what I've done on clear installation:

MacBook-Pro-Piotr-2:mage2nosql pkarwatka$ cd src/
MacBook-Pro-Piotr-2:src pkarwatka$ git pull
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/DivanteLtd/mage2nosql
   af6a31f..e1f2f81  master     -> origin/master
Updating af6a31f..e1f2f81
Fast-forward
 src/package.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
MacBook-Pro-Piotr-2:src pkarwatka$ npm install
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN magentosync@1.0.0 No repository field.

added 311 packages in 11.667s


   ╭─────────────────────────────────────╮
   │                                     │
   │   Update available 5.4.1 → 5.4.2    │
   │     Run npm i -g npm to update      │
   │                                     │
   ╰─────────────────────────────────────╯

MacBook-Pro-Piotr-2:src pkarwatka$ node --harmony cli.js fullreindex
2017-10-03T06:57:53.496Z - debug: Elasticsearch module initialized!
info: Winston logging library initialized.
2017-10-03T06:57:53.962Z - info: Connected correctly to server
2017-10-03T06:57:53.962Z - info: TRANSACTION KEY = 1507013873932
debug: Calling API endpoint: GET http://magento2.demo-1.divante.pl/rest//V1/categories
2017-10-03T06:57:53.989Z - debug: Elasticsearch module initialized!
2017-10-03T06:57:53.989Z - info: Connected correctly to server
2017-10-03T06:57:53.989Z - info: TRANSACTION KEY = 1507013873989
debug: Calling API endpoint: GET http://magento2.demo-1.divante.pl/rest//V1/categories
debug: Response received.
error: API call failed: HTTP ERROR undefined
2017-10-03T06:57:54.270Z - error: HTTP ERROR undefined
2017-10-03T06:57:54.271Z - info: Cleaning up with tsk = 1507013873932
2017-10-03T06:57:54.276Z - error: No items given to processItems call!
debug: Response received.
error: API call failed: HTTP ERROR undefined
2017-10-03T06:57:54.280Z - error: HTTP ERROR undefined
2017-10-03T06:57:54.280Z - info: Renaming the cache key to production! 
2017-10-03T06:57:54.280Z - info: Publishing cache keys to production finished!
2017-10-03T06:57:54.281Z - debug: Stepping to next action
2017-10-03T06:57:54.281Z - error: No items given to processItems call!
2017-10-03T06:57:54.281Z - info: Starting full products reindex!
2017-10-03T06:57:54.283Z - debug: Elasticsearch module initialized!
2017-10-03T06:57:54.283Z - info: Running in MPM (Multi Process Mode) with partitions count = 4
object
debug: Calling API endpoint: GET http://magento2.demo-1.divante.pl/rest//V1/products?searchCriteria=&searchCriteria[currentPage]=1&searchCriteria[pageSize]=1
debug: Response received.
error: API call failed: HTTP ERROR undefined
2017-10-03T06:57:54.382Z - error: Unhandled Rejection at: Promise Promise {
  <rejected> Error: HTTP ERROR undefined
    at /Users/pkarwatka/Downloads/mage2nosql/src/adapters/magento/product.js:62:15
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) } reason: Error: HTTP ERROR undefined
    at /Users/pkarwatka/Downloads/mage2nosql/src/adapters/magento/product.js:62:15
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
2017-10-03T06:57:55.486Z - info:  
{ took: 620,
  timed_out: false,
  total: 39,
  deleted: 39,
  batches: 1,
  version_conflicts: 0,
  noops: 0,
  retries: { bulk: 0, search: 0 },
  throttled_millis: 0,
  requests_per_second: -1,
  throttled_until_millis: 0,
  failures: [] }
^C

Nevermind the "ERROR" messages - it's because I've not properly configured Magento endpoints.

I have the same issue, as it is giving
**" error: API call failed: HTTP ERROR undefined

2020-06-09T03:26:33.537Z - error: Unhandled Rejection at: Promise Promise {
Error: HTTP ERROR undefined
at api.products.list.catch (/home/www/vsf/vue-storefront-api/node_modules/mage2vuestorefront/src/adapters/magento/product.js:209:15)
at process._tickCallback (internal/process/next_tick.js:68:7) } reason:
{ message: 'HTTP ERROR undefined',
stack:
'Error: HTTP ERROR undefined\n at api.products.list.catch (/home/www/vsf/vue-storefront-api/node_modules/mage2vuestorefront/src/adapters/magento/product.js:209:15)\n at process._tickCallback (internal/process/next_tick.js:68:7)' } "**

Please let me know the source of the problem.

P.S. My Vue storefront is https and the backend is http. Moreover the api is not running at IP address:8080