fsyntax / medusa-plugin-printful

Printful Integration for Medusajs
32 stars 7 forks source link

Error while syncing a printful Shop with multiple Variants #6

Open stephane-segning opened 11 months ago

stephane-segning commented 11 months ago

Hello guys! Thank you for this awesome plugin! I'd like to contribute to it. I have this issue when I try to sync from my printful store to my medusa:

[medusa-plugin-printful]: There appeared an error trying to create '<Product name>' in Medusa:  Error: Product options length does not match variant options length. Product has 2 and variant has 0.
    at _loop_1 (/Users/selast/Developer/projects/vymalo-store/vymalo-store/node_modules/.pnpm/@medusajs+medusa@1.18.0_@babel+core@7.23.3_@types+ioredis-mock@8.2.5_graphql@16.8.1_medusa-in_7b45u327hy534hn34sxwnoh7au/node_modules/@medusajs/medusa/dist/services/product-variant.js:1153:23)
    at ProductVariantService.validateVariantsToCreate_ (/Users/selast/Developer/projects/vymalo-store/vymalo-store/node_modules/.pnpm/@medusajs+medusa@1.18.0_@babel+core@7.23.3_@types+ioredis-mock@8.2.5_graphql@16.8.1_medusa-in_7b45u327hy534hn34sxwnoh7au/node_modules/@medusajs/medusa/dist/services/product-variant.js:1173:17)
    at ProductVariantService.<anonymous> (/Users/selast/Developer/projects/vymalo-store/vymalo-store/node_modules/.pnpm/@medusajs+medusa@1.18.0_@babel+core@7.23.3_@types+ioredis-mock@8.2.5_graphql@16.8.1_medusa-in_7b45u327hy534hn34sxwnoh7au/node_modules/@medusajs/medusa/dist/services/product-variant.js:237:50)
    at step (/Users/selast/Developer/projects/vymalo-store/vymalo-store/node_modules/.pnpm/@medusajs+medusa@1.18.0_@babel+core@7.23.3_@types+ioredis-mock@8.2.5_graphql@16.8.1_medusa-in_7b45u327hy534hn34sxwnoh7au/node_modules/@medusajs/medusa/dist/services/product-variant.js:59:23)
    at Object.next (/Users/selast/Developer/projects/vymalo-store/vymalo-store/node_modules/.pnpm/@medusajs+medusa@1.18.0_@babel+core@7.23.3_@types+ioredis-mock@8.2.5_graphql@16.8.1_medusa-in_7b45u327hy534hn34sxwnoh7au/node_modules/@medusajs/medusa/dist/services/product-variant.js:40:53)
    at fulfilled (/Users/selast/Developer/projects/vymalo-store/vymalo-store/node_modules/.pnpm/@medusajs+medusa@1.18.0_@babel+core@7.23.3_@types+ioredis-mock@8.2.5_graphql@16.8.1_medusa-in_7b45u327hy534hn34sxwnoh7au/node_modules/@medusajs/medusa/dist/services/product-variant.js:31:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'invalid_data',
  code: undefined,
  date: 2023-11-24T10:11:50.707Z
}

with this config:

...
{
    resolve: "medusa-plugin-printful",
    options: {
      printfulAccessToken: process.env.PRINTFUL_ACCESS_TOKEN,
      storeId: process.env.PRINTFUL_STORE_ID,
      backendUrl: process.env.BACKEND_URL,
      redisURL: REDIS_URL, // <-- this one was not clear to guess. You should maybe update the doc
      enableWebhooks: process.env.NODE_ENV === "production",
      enableSync: true,
      productTags: true,
      // confirmOrder: true
    }
  },
...

And now the question is to know how this can be fixed.

Thank you in advance for any help

alexookah commented 10 months ago

I have the same problem:

[medusa-plugin-printful]: There appeared an error trying to create 'Short Sleeve T-Shirt' in Medusa:  Error: Product options length does not match variant options length. Product has 2 and variant has 0.
    at _loop_1 (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/@medusajs/medusa/dist/services/product-variant.js:1153:23)
    at ProductVariantService.validateVariantsToCreate_ (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/@medusajs/medusa/dist/services/product-variant.js:1173:17)
    at ProductVariantService.<anonymous> (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/@medusajs/medusa/dist/services/product-variant.js:237:50)
    at step (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/@medusajs/medusa/dist/services/product-variant.js:59:23)
    at Object.next (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/@medusajs/medusa/dist/services/product-variant.js:40:53)
    at fulfilled (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/@medusajs/medusa/dist/services/product-variant.js:31:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'invalid_data',
  code: undefined,
  date: 2023-12-30T13:59:09.912Z
}
Job failed with ID 11: undefined
TypeError: Cannot read properties of undefined (reading 'message')
    at handleFailed (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/bullmq/dist/cjs/classes/worker.js:316:29)
    at Worker.processJob (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/bullmq/dist/cjs/classes/worker.js:345:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Worker.retryIfFailed (/Users/alexookahbeast/Documents/github/medusajs-cwr-setup/medusa-backend/node_modules/bullmq/dist/cjs/classes/worker.js:524:24)
Pimeq commented 8 months ago

Did you guys happen to figure it out? Im having the same issue sadly

jamcalli commented 6 months ago

Was anyone able to figure this one out?

DelvLoping commented 3 months ago

Hi guys, I have the same problem.

[medusa-plugin-printful]: Processing job #1 - [352574343] tesssst [medusa-plugin-printful]: There appeared an error trying to create 'tesssst' in Medusa:  Error: Product options length does not match variant options length. Product has 1 and variant has 0.

Did someone solve it?