Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create products: AwilixResolutionError #12

Open
JosephClay opened this issue Jan 16, 2025 · 1 comment
Open

Unable to create products: AwilixResolutionError #12

JosephClay opened this issue Jan 16, 2025 · 1 comment

Comments

@JosephClay
Copy link

JosephClay commented Jan 16, 2025

Using the main branch, following the excellent medium articles

After creating the super store and a new store, creating a product as either user results in an error in medusa's default product creation workflow

http:    POST /admin/products ← http://localhost:9000/app/products/create (500) - 1771.068 ms
error:   Could not resolve 'undefined'.

Resolution path: 
{
  message: "Could not resolve 'undefined'.\n\nResolution path: ",
  name: 'AwilixResolutionError',
  stack: "AwilixResolutionError: Could not resolve 'undefined'.\n" +
    '\n' +
    'Resolution path: \n' +
    '    at resolve (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/awilix/src/container.ts:497:15)\n' +
    '    at Object.container.resolve (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/orchestration/src/workflow/local-workflow.ts:105:24)\n' +
    '    at Object.exports.associateProductsWithSalesChannelsStep.async.container.container (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/core-flows/src/sales-channel/steps/associate-products-with-channels.ts:23:34)\n' +
    '    at Object.invoke (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/workflows-sdk/src/utils/composer/helpers/create-step-handler.ts:72:67)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
    '    at async DistributedTransaction.handler (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/orchestration/src/workflow/workflow-manager.ts:214:16)\n' +
    '    at async stepHandler (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:827:20)\n' +
    '    at async Promise.allSettled (index 0)\n' +
    '    at async promiseAll (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/orchestration/node_modules/@medusajs/utils/src/common/promise-all.ts:27:18)\n' +
    '    at async TransactionOrchestrator.executeNext (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:965:7)\n' +
    '    at async executeNext (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:1013:14)\n' +
    '    at async TransactionOrchestrator.resume (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:1028:5)\n' +
    '    at async LocalWorkflow.run (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/orchestration/src/workflow/local-workflow.ts:371:5)\n' +
    '    at async originalExecution (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/workflows-sdk/src/helper/workflow-export.ts:111:26)\n' +
    '    at async LocalWorkflow.newRun [as run] (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/workflows-sdk/src/helper/workflow-export.ts:190:12)\n' +
    '    at async POST (/dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/medusa/src/api/admin/products/route.ts:41:22)\n' +
    '    at async /dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/utils/src/common/wrap-handler.ts:17:14\n' +
    '⮑ sat /dev/medusa2-marketplace-demo-main/medusa-marketplace-demo/node_modules/@medusajs/core-flows/dist/product/workflows/create-products.js: [create-products -> associate-products-with-channels (invoke)]'
  }
}

sample payload posted:

{"status":"published","is_giftcard":false,"sales_channels":[{"id":"sc_01JHQXJZWRY6W2RD4N89M6GPG6"}],"images":[],"categories":[],"title":"Winter jacket","discountable":true,"options":[{"title":"Default option","values":["Default option value"]}],"variants":[{"title":"Default variant","options":{"Default option":"Default option value"},"manage_inventory":false,"allow_backorder":false,"inventory_items":[],"prices":[]}]}

sample response:

{
    "code": "unknown_error",
    "type": "unknown_error",
    "message": "An unknown error occurred."
}
@JosephClay
Copy link
Author

also, thank you for attempting to get this functionality in medusa! we're trying out your solution as a way to implement multi-tenancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant