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
http://vuestorefront.io
MIT License
199 stars 112 forks source link

Error taxrule #76

Open fabriciomoeller opened 5 years ago

fabriciomoeller commented 5 years ago

When migrating with mag2vs import to a standard store with a registered product generated the following error in scheme taxrule.

> vue-storefront-api@0.1.0 migrate /Users/fabriciomoeller/programacao/store/vue-storefront-api
> node node_modules/migrate/bin/migrate

Elasticsearch INFO: 2019-02-24T15:02:56Z
  Adding connection to http://localhost:9200/

  up : 1513602693128-create_new_index.js
Elasticsearch DEBUG: 2019-02-24T15:02:56Z
  starting request {
    "method": "DELETE",
    "path": "/*/_alias/vue_storefront_catalog",
    "query": {}
  }

Elasticsearch DEBUG: 2019-02-24T15:02:56Z
  Request complete

Public index alias does not exists [aliases_not_found_exception] aliases [vue_storefront_catalog] missing, with { resource.type="aliases" & resource.id="vue_storefront_catalog" }
Elasticsearch DEBUG: 2019-02-24T15:02:56Z
  starting request {
    "method": "DELETE",
    "path": "/vue_storefront_catalog",
    "query": {}
  }

Elasticsearch DEBUG: 2019-02-24T15:02:56Z
  Request complete

Elasticsearch DEBUG: 2019-02-24T15:02:56Z
  starting request {
    "method": "PUT",
    "path": "/vue_storefront_catalog",
    "body": {
      "settings": {
        "analysis": {
          "tokenizer": {
            "comma": {
              "type": "pattern",
              "pattern": ","
            }
          },
          "analyzer": {
            "comma": {
              "type": "custom",
              "tokenizer": "comma"
            }
          }
        }
      }
    },
    "query": {}
  }

Elasticsearch DEBUG: 2019-02-24T15:02:57Z
  Request complete

{ acknowledged: true,
  shards_acknowledged: true,
  index: 'vue_storefront_catalog' }
  up : 1513602868543-change_field_types.js
Elasticsearch DEBUG: 2019-02-24T15:02:57Z
  starting request {
    "method": "PUT",
    "path": "/vue_storefront_catalog/_mapping/product",
    "body": {
      "properties": {
        "sku": {
          "type": "keyword"
        },
        "url_key": {
          "type": "keyword"
        },
        "slug": {
          "type": "keyword"
        },
        "size": {
          "type": "integer"
        },
        "size_options": {
          "type": "integer"
        },
        "price": {
          "type": "float"
        },
        "has_options": {
          "type": "integer"
        },
        "special_price": {
          "type": "float"
        },
        "color": {
          "type": "integer"
        },
        "color_options": {
          "type": "integer"
        },
        "pattern": {
          "type": "text"
        },
        "id": {
          "type": "long"
        },
        "status": {
          "type": "integer"
        },
        "weight": {
          "type": "integer"
        },
        "visibility": {
          "type": "integer"
        },
        "created_at": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "updated_at": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "special_from_date": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "special_to_date": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "news_from_date": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "news_to_date": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "description": {
          "type": "text"
        },
        "name": {
          "type": "text"
        },
        "configurable_children": {
          "properties": {
            "url_key": {
              "type": "keyword"
            },
            "sku": {
              "type": "keyword"
            },
            "has_options": {
              "type": "boolean"
            },
            "price": {
              "type": "float"
            },
            "special_price": {
              "type": "float"
            }
          }
        },
        "configurable_options": {
          "properties": {
            "attribute_id": {
              "type": "long"
            },
            "default_label": {
              "type": "text"
            },
            "label": {
              "type": "text"
            },
            "frontend_label": {
              "type": "text"
            },
            "store_label": {
              "type": "text"
            },
            "values": {
              "properties": {
                "default_label": {
                  "type": "text"
                },
                "label": {
                  "type": "text"
                },
                "frontend_label": {
                  "type": "text"
                },
                "store_label": {
                  "type": "text"
                },
                "value_index": {
                  "type": "keyword"
                }
              }
            }
          }
        },
        "category_ids": {
          "type": "long"
        },
        "eco_collection": {
          "type": "integer"
        },
        "eco_collection_options": {
          "type": "integer"
        },
        "erin_recommends": {
          "type": "integer"
        },
        "position": {
          "type": "integer"
        },
        "tax_class_id": {
          "type": "integer"
        },
        "required_options": {
          "type": "integer"
        },
        "Size_options": {
          "type": "keyword"
        },
        "Color_options": {
          "type": "keyword"
        }
      }
    },
    "query": {}
  }

Elasticsearch DEBUG: 2019-02-24T15:02:57Z
  Request complete

{ acknowledged: true }
Elasticsearch DEBUG: 2019-02-24T15:02:57Z
  starting request {
    "method": "PUT",
    "path": "/vue_storefront_catalog/_mapping/taxrule",
    "body": {
      "properties": {
        "id": {
          "type": "long"
        },
        "rates": {
          "properties": {
            "rate": {
              "type": "float"
            }
          }
        }
      }
    },
    "query": {}
  }

Elasticsearch DEBUG: 2019-02-24T15:02:57Z
  Request complete

(node:49271) UnhandledPromiseRejectionWarning: Error: [illegal_argument_exception] Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [product, taxrule] :: {"path":"/vue_storefront_catalog/_mapping/taxrule","query":{},"body":"{\"properties\":{\"id\":{\"type\":\"long\"},\"rates\":{\"properties\":{\"rate\":{\"type\":\"float\"}}}}}","statusCode":400,"response":"{\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [product, taxrule]\"}],\"type\":\"illegal_argument_exception\",\"reason\":\"Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [product, taxrule]\"},\"status\":400}"}
    at db.indices.putMapping.then.catch.err2 (/Users/fabriciomoeller/programacao/store/vue-storefront-api/src/lib/elastic.js:177:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:49271) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:49271) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

my config/local.json

{
    "port": 8080,
    "objHashSecret": "__SECRET_CHANGE_ME__",
    "bodyLimit": "100kb",
    "corsHeaders": [
        "Link"
    ],
    "kue": {},
    "tax": {
        "defaultCountry": "pt_BR",
        "defaultRegion": "",
        "calculateServerSide": true,
        "alwaysSyncPlatformPricesOver": false,
        "usePlatformTotals": true,
        "setConfigurableProductOptions": false,
        "sourcePriceIncludesTax": true
    },
    "platform": "magento2",
    "registeredExtensions": [
        "mailchimp-subscribe"
    ],
    "extensions": {
        "mailchimp": {
            "listId": "e06875a7e1",
            "apiKey": "a9a3318ea7d30f5c5596bd4a78ae0985-us3",
            "apiUrl": "https://us3.api.mailchimp.com/3.0"
        }
    },
    "magento2": {
        "url": "http://localhost:8888/magento2/",
        "imgUrl": "http://localhost:8888/magento2/media/catalog/product",
        "magentoUserName": "",
        "magentoUserPassword": "",
        "httpUserName": "",
        "httpUserPassword": "",
        "api": {
            "url": "http://localhost:8888/magento2/rest",
            "consumerKey": "cxb1r03urkhlu0jyya7o3fhdqz1x4lss",
            "consumerSecret": "i23r330n6y6h3t0zta5qz9dcovwnvyl6",
            "accessToken": "w87znglng7doiaz629l5qg8rrh0kr0di",
            "accessTokenSecret": "vah2yyosm3459biw1edyi0jca6duhpop"
        }
    },
    "imageable": {
        "namespace": "",
        "maxListeners": 512,
        "imageSizeLimit": 1024,
        "timeouts": {
            "convert": 5000,
            "identify": 100,
            "download": 1000
        },
        "whitelist": {
            "allowedHosts": [
                "localhost:8888/magento2/"
            ],
            "trustedHosts": [
                "localhost:8888/magento2/"
            ]
        },
        "keepDownloads": true,
        "maxDownloadCacheSize": 1000,
        "tmpPathRoot": "/tmp"
    },
    "elasticsearch": {
        "host": "localhost",
        "port": "9200",
        "indices": [
            "vue_storefront_catalog"
        ]
    }
}

my config/default.json

{
  "server": {
    "host": "localhost",
    "port": 8080,
    "searchEngine": "elasticsearch"
  },
  "orders": {
    "useServerQueue": false
  },
  "catalog": {
    "excludeDisabledProducts": false
  },
  "elasticsearch": {
    "host": "localhost",
    "port": 9200,
    "protocol": "http",
    "user": "elastic",
    "password": "changeme",
    "min_score": 0.01,
    "indices": [
      "vue_storefront_catalog",
      "vue_storefront_catalog_de",
      "vue_storefront_catalog_it"
    ],
    "indexTypes": [
      "product",
      "category",
      "cms",
      "attribute",
      "taxrule",
      "review"
    ],
    "apiVersion": "5.6"
  },
  "redis": {
    "host": "localhost",
    "port": 6379,
    "db": 0
  },
  "kue": {},
  "availableStores": [
    "de",
    "it"
  ],
  "storeViews": {
    "multistore": true,
    "mapStoreUrlsFor": [
      "de",
      "it"
    ],
    "de": {
      "storeCode": "de",
      "disabled": true,
      "storeId": 3,
      "name": "German Store",
      "url": "/de",
      "elasticsearch": {
        "host": "localhost:8080/api/catalog",
        "index": "vue_storefront_catalog_de"
      },
      "tax": {
        "defaultCountry": "DE",
        "defaultRegion": "",
        "calculateServerSide": true,
        "sourcePriceIncludesTax": true
      },
      "i18n": {
        "fullCountryName": "Germany",
        "fullLanguageName": "German",
        "defaultLanguage": "DE",
        "defaultCountry": "DE",
        "defaultLocale": "de-DE",
        "currencyCode": "EUR",
        "currencySign": "EUR",
        "dateFormat": "HH:mm D-M-YYYY"
      }
    },
    "it": {
      "storeCode": "it",
      "disabled": true,
      "storeId": 4,
      "name": "Italian Store",
      "url": "/it",
      "elasticsearch": {
        "host": "localhost:8080/api/catalog",
        "index": "vue_storefront_catalog_it"
      },
      "tax": {
        "defaultCountry": "IT",
        "defaultRegion": "",
        "calculateServerSide": true,
        "sourcePriceIncludesTax": true
      },
      "i18n": {
        "fullCountryName": "Italy",
        "fullLanguageName": "Italian",
        "defaultCountry": "IT",
        "defaultLanguage": "IT",
        "defaultLocale": "it-IT",
        "currencyCode": "EUR",
        "currencySign": "EUR",
        "dateFormat": "HH:mm D-M-YYYY"
      }
    }
  },
  "authHashSecret": "__SECRET_CHANGE_ME__",
  "objHashSecret": "__SECRET_CHANGE_ME__",
  "cart": {
    "setConfigurableProductOptions": false
  },
  "tax": {
    "defaultCountry": "PL",
    "defaultRegion": "",
    "calculateServerSide": true,
    "alwaysSyncPlatformPricesOver": false,
    "usePlatformTotals": true,
    "setConfigurableProductOptions": true,
    "sourcePriceIncludesTax": true
  },
  "bodyLimit": "100kb",
  "corsHeaders": [
    "Link"
  ],
  "platform": "magento2",
  "registeredExtensions": [
    "mailchimp-subscribe",
    "example-magento-api",
    "cms-data",
    "mail-service"
  ],
  "extensions": {
    "mailchimp": {
      "listId": "e06875a7e1",
      "apiKey": "a9a3318ea7d30f5c5596bd4a78ae0985-us3",
      "apiUrl": "https://us3.api.mailchimp.com/3.0"
    },
    "mailService": {
      "transport": {
        "host": "smtp.gmail.com",
        "port": 465,
        "secure": true,
        "user": "vuestorefront",
        "pass": "vuestorefront.io"
      },
      "targetAddressWhitelist": ["contributors@vuestorefront.io"],
      "secretString": "__THIS_IS_SO_SECRET__"
    }
  },
  "magento2": {
      "url": "http://localhost:8888/magento2/",
      "imgUrl": "http://localhost:8888/magento2/media/catalog/product",
      "magentoUserName": "",
      "magentoUserPassword": "",
      "httpUserName": "",
      "httpUserPassword": "",
      "api": {
          "url": "http://localhost:8888/magento2/rest",
          "consumerKey": "cxb1r03urkhlu0jyya7o3fhdqz1x4lss",
          "consumerSecret": "i23r330n6y6h3t0zta5qz9dcovwnvyl6",
          "accessToken": "w87znglng7doiaz629l5qg8rrh0kr0di",
          "accessTokenSecret": "vah2yyosm3459biw1edyi0jca6duhpop"
      }
  },
  "imageable": {
    "namespace": "",
    "maxListeners": 512,
    "imageSizeLimit": 1024,
    "whitelist": {
      "allowedHosts": [
        "localhost:8888/magento2/"
      ]
    },
    "cache": {
      "memory": 50,
      "files": 20,
      "items": 100
    },
    "concurrency": 0,
    "counters": {
      "queue": 2,
      "process": 4
    },
    "simd": true,
    "keepDownloads": true
  },
  "entities": {
      "category": {
        "includeFields": [ "children_data", "id", "children_count", "sku", "name", "is_active", "parent_id", "level", "url_key" ]
      },
      "attribute": {
        "includeFields": [ "attribute_code", "id", "entity_type_id", "options", "default_value", "is_user_defined", "frontend_label", "attribute_id", "default_frontend_label", "is_visible_on_front", "is_visible", "is_comparable" ]
      },
      "productList": {
        "sort": "",
        "includeFields": [ "type_id", "sku", "product_links",  "special_price", "special_to_date", "special_from_date", "name", "price", "priceInclTax", "originalPriceInclTax", "originalPrice", "specialPriceInclTax", "id", "image", "sale", "new", "url_key" ],
        "excludeFields": [ "configurable_children", "description", "configurable_options", "sgn" ]
      },
      "productListWithChildren": {
        "includeFields": [ "type_id", "sku", "name", "special_price", "special_to_date", "special_from_date", "price", "priceInclTax", "originalPriceInclTax", "originalPrice", "specialPriceInclTax", "id", "image", "sale", "new", "configurable_children.image", "configurable_children.sku", "configurable_children.price", "configurable_children.special_price", "configurable_children.priceInclTax", "configurable_children.specialPriceInclTax", "configurable_children.originalPrice", "configurable_children.originalPriceInclTax", "configurable_children.color", "configurable_children.size", "product_links", "url_key"],
        "excludeFields": [ "description", "sgn"]
      },
      "product": {
        "excludeFields": [ "updated_at", "created_at", "attribute_set_id", "status", "visibility", "tier_prices", "options_container", "msrp_display_actual_price_type", "has_options", "stock.manage_stock", "stock.use_config_min_qty", "stock.use_config_notify_stock_qty", "stock.stock_id",  "stock.use_config_backorders", "stock.use_config_enable_qty_inc", "stock.enable_qty_increments", "stock.use_config_manage_stock", "stock.use_config_min_sale_qty", "stock.notify_stock_qty", "stock.use_config_max_sale_qty", "stock.use_config_max_sale_qty", "stock.qty_increments", "small_image"],
        "includeFields": null,
        "filterFieldMapping": {
          "category.name": "category.name.keyword"
        }
      }
    },
  "usePriceTiers": false,
  "boost": {
    "name": 3,
    "category.name": 1,
    "short_description": 1,
    "description": 1,
    "sku": 1,
    "configurable_children.sku": 1
  }
}
pkarw commented 5 years ago

Hi! We’re currently supporting just ES 5.6 this kind of issues are typical to ES 6.x. Isn’t this a reason?

fabriciomoeller commented 5 years ago

Yes, you're right.

./elasticsearch -version Version: 6.6.0, Build: default / tar / a9861f4 / 2019-01-24T11: 27: 09.439740Z, JVM: 1.8.0_202

Thank you