workwithpact/StoreDuplicator

422 on Products

calebcurtis8 opened this issue · 9 comments

After running yarn start --products each product fails to import to an empty destination store and there is a http 422 error which I can see after adding a console log. I double checked the permissions on both stores and yarn start returns "Store configuration looks correct."

I'm guessing there's an issue with line 174 of migrator.js and the structure of the product object
const newProduct = await this.destination.product.create(product)

Have you tried it more than once? We've seen a few images fail over time, breaking the product import. Running it a second time might do the trick, and wouldn't import already-imported products

Yes, I've only tried it on one source store though, and it's failing on every product.
Image 2021-03-11 at 12 54 56 PM

Perhaps it is related to the number of metafields on these products or the content within them, from another store with less metafields I am not having that problem.

(Sorry, I somehow did not get a notification when you answered!)
Interesting; The amount of metafields shouldn't matter. Do these products have anything in common (ex: are they gift cards?).
Creating gift cards through the API is currently not supported, so that could explain it...

Oh! You are totally right! It could absolutely be a compare_at_price issue.
If you're feeling adventurous, you could open up shopify-api-node in node_modules and add a console.log to the value of "body" in this file; it should show what the actual error is, and help solve this :)

I was able to fix it for me, but I'm not sure it's a full solution, so I added at line 172 of migrator.js

/*reset fulfillment services to shopify*/
      delete product.variants[i].fulfillment_service
      product.variants[i].inventory_management = 'shopify'

Very very very good find! That's definitely a good interim solution :-)