Closed habibullahturkmen closed 1 year ago
Sorry for my naive explanation. I'd love to answer questions on the matter. Thank you.
We will attend to a fix asap and include it in the upcoming release, which is scheduled for this week - might even be today.
I attach screenshots as a prove the store api is not returning field inventory_quantity
properly and it does return when calling the admin api:
For the missing inventory_quantity field, we can pass the sales channel in the request explicitly: GET /store/products/:id?sales_channel_id=some_id
Thanks @pepiyu. We have identified the culprit and are working on a fix. It will be part of next release.
In the meantime, you can add sales_channel_id=[some_id]
to your storefront queries to retrieve inventory quantity.
So it will look like:
GET /store/products/:id?sales_channel_id=[some_id]
GET /store/products?sales_channel_id=[some_id]
.@habibullahturkmen – I can't reproduce the issue you describe around adding stock locations. I've tried several times.
Please ensure you've run the migrations and the script, as explained in the 1.8 upgrade guide.
I will close this for now.
Bug report
Describe the bug
Products created prior to Medusa 1.8
The product already has 10 items in the inventory. When I activate "manage inventory" button on the new admin panel. I get the following error: POST http://localhost:9000/admin/inventory-items 500 (Internal Server Error) Response: {"code":"unknown_error","type":"unknown_error","message":"An unknown error occurred."}
System information
Medusa version (including plugins): 1.8 "@medusajs/admin": "^2.0.0", "@medusajs/cache-redis": "^1.8.0", "@medusajs/event-bus-redis": "^1.8.0", "@medusajs/inventory": "^1.8.0", "@medusajs/medusa": "^1.8.0", "@medusajs/medusa-cli": "^1.3.8", "@medusajs/stock-location": "^1.8.0", "express": "^4.18.2", "medusa-file-minio": "^1.1.6", "medusa-fulfillment-manual": "^1.1.37", "medusa-interfaces": "^1.3.7", "medusa-payment-manual": "^1.0.23", "medusa-payment-stripe": "^2.0.0", "medusa-plugin-meilisearch": "^2.0.0", "medusa-plugin-sendgrid": "^1.3.8", "medusa-plugin-slack-notification": "^1.3.9", "nodemailer": "^6.9.1", "nodemailer-mailgun-transport": "^2.1.5", "typeorm": "0.3.11"
Node.js version: v18.15.0 Database: PostgreSQL 15 Operating system: Windows 11 Browser (if relevant): Google Chrome / Mozilla Firefox
Steps to reproduce the behavior
Expected behavior
Screenshots
This product was created before the upgrade (v1.8)
Code snippets
If applicable, add code samples to help explain your problem
Additional context: logs
info: Processing inventory-item.created which has 0 subscribers error: Cannot read properties of undefined (reading 'inventory_item_id') TypeError: Cannot read properties of undefined (reading 'inventory_item_id') at C:\Users\Habibullah\Projects\medusa\medusa-production\medusa-api\node_modules\@medusajs\medusa\dist\api\routes\admin\inventory-items\create-inventory-item.js:187:95 at step (C:\Users\Habibullah\Projects\medusa\medusa-production\medusa-api\node_modules\@medusajs\medusa\dist\api\routes\admin\inventory-items\create-inventory-item.js:57:23) at Object.next (C:\Users\Habibullah\Projects\medusa\medusa-production\medusa-api\node_modules\@medusajs\medusa\dist\api\routes\admin\inventory-items\create-inventory-item.js:38:53) at fulfilled (C:\Users\Habibullah\Projects\medusa\medusa-production\medusa-api\node_modules\@medusajs\medusa\dist\api\routes\admin\inventory-items\create-inventory-item.js:29:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ::1 - - [10/Apr/2023:19:39:41 +0000] "POST /admin/inventory-items HTTP/1.1" 500 86 "http://localhost:9000/app/a/products/prod_01GVJYRM9ZZDBKMJBFP77JTR2J" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" info: Processing inventory-item.created which has 0 subscribers ::1 - - [10/Apr/2023:19:40:57 +0000] "GET /admin/batch-jobs?limit=100 HTTP/1.1" 304 - "http://localhost:9000/app/a/products/prod_01GVJYRM9ZZDBKMJBFP77JTR2J" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" ::1 - - [10/Apr/2023:19:42:41 +0000] "GET /admin/batch-jobs?limit=100 HTTP/1.1" 304 - "http://localhost:9000/app/a/products/prod_01GVJYRM9ZZDBKMJBFP77JTR2J" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" ::1 - - [10/Apr/2023:19:43:42 +0000] "GET /admin/batch-jobs?limit=100 HTTP/1.1" 304 - "http://localhost:9000/app/a/products/prod_01GVJYRM9ZZDBKMJBFP77JTR2J" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" ::1 - - [10/Apr/2023:19:45:13 +0000] "GET /admin/batch-jobs?limit=100 HTTP/1.1" 304 - "http://localhost:9000/app/a/products/prod_01GVJYRM9ZZDBKMJBFP77JTR2J" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" ::1 - - [10/Apr/2023:19:47:46 +0000] "GET /admin/batch-jobs?limit=100 HTTP/1.1" 304 - "http://localhost:9000/app/a/products/prod_01GVJYRM9ZZDBKMJBFP77JTR2J" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" error: Cannot read properties of undefined (reading 'inventory_item_id') TypeError: Cannot read properties of undefined (reading 'inventory_item_id') at C:\Users\Habibullah\Projects\medusa\medusa-production\medusa-api\node_modules\@medusajs\medusa\dist\api\routes\admin\inventory-items\create-inventory-item.js:187:95 at step (C:\Users\Habibullah\Projects\medusa\medusa-production\medusa-api\node_modules\@medusajs\medusa\dist\api\routes\admin\inventory-items\create-inventory-item.js:57:23) at Object.next (C:\Users\Habibullah\Projects\medusa\medusa-production\medusa-api\node_modules\@medusajs\medusa\dist\api\routes\admin\inventory-items\create-inventory-item.js:38:53) at fulfilled (C:\Users\Habibullah\Projects\medusa\medusa-production\medusa-api\node_modules\@medusajs\medusa\dist\api\routes\admin\inventory-items\create-inventory-item.js:29:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ::1 - - [10/Apr/2023:19:49:03 +0000] "POST /admin/inventory-items HTTP/1.1" 500 86 "http://localhost:9000/app/a/products/prod_01GVJYRM9ZZDBKMJBFP77JTR2J" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" info: Processing inventory-item.created which has 0 subscribers error: Cannot read properties of undefined (reading 'inventory_item_id')