Skip to content

Product-sync TypeError on attribute null values #215

@butenkor

Description

@butenkor

Expected behavior

Should not throw an error if product attribute value for set of enums is null:

{
  "name": "laender",
  "value": [
    null
  ]
}

Actual behavior

{"name":"xxx","widget_type":"product-import","hostname":"xxx","pid":1,"level":50,"myMsg":"Error - Error on product sync. Skip and continue.","error":{"type":"TypeError","message":"Cannot set property 'MATCH_CRITERIA' of undefined","name":"TypeError","stack":"TypeError: Cannot set property 'MATCH_CRITERIA' of undefined\n at /app/node_modules/sphere-node-sdk/lib/sync/utils/product.js:79:42\n at Function..each..forEach (/app/node_modules/underscore/underscore.js:153:9)\n at /app/node_modules/sphere-node-sdk/lib/sync/utils/product.js:77:22\n at Function..each..forEach (/app/node_modules/underscore/underscore.js:153:9)\n at patchSetLText (/app/node_modules/sphere-node-sdk/lib/sync/utils/product.js:75:18)\n at /app/node_modules/sphere-node-sdk/lib/sync/utils/product.js:103:9\n at Function..each..forEach (/app/node_modules/underscore/underscore.js:153:9)\n at patch (/app/node_modules/sphere-node-sdk/lib/sync/utils/product.js:97:16)\n at ProductUtils.diff (/app/node_modules/sphere-node-sdk/lib/sync/utils/product.js:112:5)\n at ProductSync.BaseSync.buildActions (/app/node_modules/sphere-node-sdk/lib/sync/base-sync.js:26:24)\n at ProductSync.buildActions (/app/node_modules/sphere-node-sdk/lib/sync/product-sync.js:25:47)\n at /app/node_modules/sphere-product-import/dist/product-import.js:352:37\n at tryCatcher (/app/node_modules/sphere-product-import/node_modules/bluebird/js/main/util.js:26:23)\n at Promise._settlePromiseFromHandler (/app/node_modules/sphere-product-import/node_modules/bluebird/js/main/promise.js:507:31)\n at Promise._settlePromiseAt (/app/node_modules/sphere-product-import/node_modules/bluebird/js/main/promise.js:581:18)\n at Promise._settlePromises (/app/node_modules/sphere-product-import/node_modules/bluebird/js/main/promise.js:697:14)\n at Async._drainQueue (/app/node_modules/sphere-product-import/node_modules/bluebird/js/main/async.js:123:16)\n at Async._drainQueues (/app/node_modules/sphere-product-import/node_modules/bluebird/js/main/async.js:133:10)\n at Immediate.Async.drainQueues (/app/node_modules/sphere-product-import/node_modules/bluebird/js/main/async.js:15:14)\n at runCallback (timers.js:649:20)\n at tryOnImmediate (timers.js:622:5)\n at processImmediate [as _immediateCallback] (timers.js:594:5)"},"msg":"","time":"2017-02-19T06:40:35.105Z","v":0}

Steps to reproduce the behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions