SGFGOV / medusa-plugin-shopify-ts

Typescirpt version of the popular shopify importer plugin
MIT License
1 stars 1 forks source link

Batch processing fails with message: Cannot read properties of null (reading 'id') #4

Open keyboSlice opened 1 year ago

keyboSlice commented 1 year ago

Hi there,

Whenever I attempt to sync my medusa store from shopify I receive an error on the job processing to the effect of:

{
  "errors": [
    "Cannot read properties of null (reading 'id')"
  ],
  "stat_descriptors": [
    {
      "key": "shopify-import-status",
      "name": "Batch being currently processed",
      "message": "The batch batch_01H32DA5871FMK5YP11AAY7EMA is under pre processing"
    }
  ]
}

That error occurs on batches of smart_collections, products and custom_collections.

Do you know what might be the problem please?

github-actions[bot] commented 1 year ago

Thank you for your contribution, much appreciated. A few small issues and we should be good to go

SGFGOV commented 1 year ago

Hi

Are you sure the plugin is configured correctly?

Best regards Govind

On Fri, 16 Jun, 2023, 21:24 Keir Lavelle, @.***> wrote:

Hi there,

Whenever I attempt to sync my medusa store from shopify I receive an error on the job processing to the effect of:

{ "errors": [ "Cannot read properties of null (reading 'id')" ], "stat_descriptors": [ { "key": "shopify-import-status", "name": "Batch being currently processed", "message": "The batch batch_01H32DA5871FMK5YP11AAY7EMA is under pre processing" } ] }

That error occurs on batches of smart_collections, products and custom_collections.

Do you know what might be the problem please?

— Reply to this email directly, view it on GitHub https://github.com/SGFGOV/medusa-plugin-shopify-ts/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXEQJHDAWPFKUO26D4SANELXLR6SPANCNFSM6AAAAAAZJN75VY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited.   

keyboSlice commented 1 year ago

Hi SGFGOV, thanks so much for the quick reply!

I believe so, the plugin is certainly able to retrieve data from the shopify store as I can see in the context column that the shopify product data is available.

Would the means of invoking the service cause any issues do you know? I've created a minimal api route that very simply looks like

 const service = req.scope.resolve("postStartupActionService")
 const result = await service.syncWithShopify();
 res.json({ message: result })
keyboSlice commented 1 year ago

Here's a minimal example of the context column from one of the failed jobs:

{
    "path": "products",
    "shopifyData": [{
        "id": 6823811842235,
        "tags": "tags",
        "image": {
            "id": 29626938622139,
            "alt": null,
            "src": "https://cdn.shopify.com/s/files/1/0430/3411/6249/products/a-beast-of-burden-wall-canvas.jpg?v=1620577669",
            "width": 1000,
            "height": 750,
            "position": 1,
            "created_at": "2021-05-09T17:27:49+01:00",
            "product_id": 6823811842235,
            "updated_at": "2021-05-09T17:27:49+01:00",
            "variant_ids": [],
            "admin_graphql_api_id": "gid://shopify/ProductImage/29626938622139"
        },
        "title": "A Beast of Burden - Canvas Print",
        "handle": "a-beast-of-burden-canvas-print",
        "images": [{
            "id": 29626938622139,
            "alt": null,
            "src": "https://cdn.shopify.com/s/files/1/0430/3411/6249/products/a-beast-of-burden-wall-canvas.jpg?v=1620577669",
            "width": 1000,
            "height": 750,
            "position": 1,
            "created_at": "2021-05-09T17:27:49+01:00",
            "product_id": 6823811842235,
            "updated_at": "2021-05-09T17:27:49+01:00",
            "variant_ids": [],
            "admin_graphql_api_id": "gid://shopify/ProductImage/29626938622139"
        }],
        "status": "active",
        "vendor": "101canvasprints",
        "options": [{
            "id": 8739317776571,
            "name": "Title",
            "values": [
                "Default Title"
            ],
            "position": 1,
            "product_id": 6823811842235
        }],
        "variants": [{
            "id": 40209579704507,
            "sku": "",
            "grams": 0,
            "price": "39.99",
            "title": "Default Title",
            "weight": 0,
            "barcode": "",
            "option1": "Default Title",
            "option2": null,
            "option3": null,
            "taxable": true,
            "image_id": null,
            "position": 1,
            "created_at": "2021-05-09T17:27:47+01:00",
            "product_id": 6823811842235,
            "updated_at": "2021-05-09T17:38:27+01:00",
            "weight_unit": "lb",
            "compare_at_price": "79.99",
            "inventory_policy": "deny",
            "inventory_item_id": 42298831143099,
            "requires_shipping": true,
            "inventory_quantity": 0,
            "presentment_prices": [{
                "price": {
                    "amount": "39.99",
                    "currency_code": "GBP"
                },
                "compare_at_price": {
                    "amount": "79.99",
                    "currency_code": "GBP"
                }
            }],
            "fulfillment_service": "manual",
            "admin_graphql_api_id": "gid://shopify/ProductVariant/40209579704507",
            "inventory_management": null,
            "old_inventory_quantity": 0
        }],
        "body_html": "<p>product description</p>",
        "created_at": "2021-05-09T17:27:47+01:00",
        "updated_at": "2023-06-16T13:14:44+01:00",
        "product_type": "Canvas",
        "published_at": "2021-05-09T17:27:48+01:00",
        "published_scope": "web",
        "template_suffix": "",
        "admin_graphql_api_id": "gid://shopify/Product/6823811842235"
    }],
    "shopifyImportRequest": {
        "api_key": "<redacted>",
        "store_domain": "<redacted>",
        "auto_create_store": true,
        "default_store_name": "<redacted>"
        "enable_vendor_store": true,
        "medusa_store_admin_email": "<redacted>"
    }
}
daflav commented 1 year ago

Hello, i have the same issue.. any update ?

@keyboSlice you resolved ?


  "errors": [
    "Cannot read properties of undefined (reading 'id')"
  ],
  "stat_descriptors": [
    {
      "key": "shopify-import-status",
      "name": "Batch being currently processed",
      "message": "The batch batch_01HBNRJDK1FR7MHMXQE694B8ED is under pre processing"
    }
  ]
}
SGFGOV commented 1 year ago

What have you specified as default store name.?.it needs to be thr name of the store in medusa.

I thinknin medusa the default store name us medusa.. this is case sensitive

On Fri, 16 Jun, 2023, 21:45 Keir Lavelle, @.***> wrote:

Here's a minimal example of the context column from one of the failed jobs:

{ "path": "products", "shopifyData": [{ "id": 6823811842235, "tags": "tags", "image": { "id": 29626938622139, "alt": null, "src": "https://cdn.shopify.com/s/files/1/0430/3411/6249/products/a-beast-of-burden-wall-canvas.jpg?v=1620577669", "width": 1000, "height": 750, "position": 1, "created_at": "2021-05-09T17:27:49+01:00", "product_id": 6823811842235, "updated_at": "2021-05-09T17:27:49+01:00", "variant_ids": [], "admin_graphql_api_id": "gid://shopify/ProductImage/29626938622139" }, "title": "A Beast of Burden - Canvas Print", "handle": "a-beast-of-burden-canvas-print", "images": [{ "id": 29626938622139, "alt": null, "src": "https://cdn.shopify.com/s/files/1/0430/3411/6249/products/a-beast-of-burden-wall-canvas.jpg?v=1620577669", "width": 1000, "height": 750, "position": 1, "created_at": "2021-05-09T17:27:49+01:00", "product_id": 6823811842235, "updated_at": "2021-05-09T17:27:49+01:00", "variant_ids": [], "admin_graphql_api_id": "gid://shopify/ProductImage/29626938622139" }], "status": "active", "vendor": "101canvasprints", "options": [{ "id": 8739317776571, "name": "Title", "values": [ "Default Title" ], "position": 1, "product_id": 6823811842235 }], "variants": [{ "id": 40209579704507, "sku": "", "grams": 0, "price": "39.99", "title": "Default Title", "weight": 0, "barcode": "", "option1": "Default Title", "option2": null, "option3": null, "taxable": true, "image_id": null, "position": 1, "created_at": "2021-05-09T17:27:47+01:00", "product_id": 6823811842235, "updated_at": "2021-05-09T17:38:27+01:00", "weight_unit": "lb", "compare_at_price": "79.99", "inventory_policy": "deny", "inventory_item_id": 42298831143099, "requires_shipping": true, "inventory_quantity": 0, "presentment_prices": [{ "price": { "amount": "39.99", "currency_code": "GBP" }, "compare_at_price": { "amount": "79.99", "currency_code": "GBP" } }], "fulfillment_service": "manual", "admin_graphql_api_id": "gid://shopify/ProductVariant/40209579704507", "inventory_management": null, "old_inventory_quantity": 0 }], "body_html": "

product description

", "created_at": "2021-05-09T17:27:47+01:00", "updated_at": "2023-06-16T13:14:44+01:00", "product_type": "Canvas", "published_at": "2021-05-09T17:27:48+01:00", "published_scope": "web", "template_suffix": "", "admin_graphql_api_id": "gid://shopify/Product/6823811842235" }], "shopifyImportRequest": { "api_key": "", "store_domain": "", "auto_create_store": true, "default_store_name": "" "enable_vendor_store": true, "medusa_store_admin_email": "" } }

— Reply to this email directly, view it on GitHub https://github.com/SGFGOV/medusa-plugin-shopify-ts/issues/4#issuecomment-1594932973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXEQJHFBENGOGFAW64L4PN3XLSBDVANCNFSM6AAAAAAZJN75VY . You are receiving this because you commented.Message ID: @.***>

--

This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited.   

JackHull commented 11 months ago

Receiving the same errors. Sometimes it works, sometimes it doesn't - seems random to me. Configuration is correct.