Closed finom closed 4 months ago
@olivermrbl is this bug coming from the js sdk? right @finom could you help me to navigate to the dir that handles this call, and does medusa support this functionality as well? does this code should be working, or this feature does not exist? I can work on this
route.get(
"/:id",
transformQuery(FindParams, {
defaultRelations: defaultAdminProductRelations,
defaultFields: defaultAdminProductFields,
isList: false,
}),
middlewares.wrap(require("./get-product").default)
)
as I inspected the code @olivermrbl you should send a list of ids not an object
await medusa.product.list([1,2,3,4])
this what also mentioned in the docs
so this isn't a bug, the title of this issue should be change into requesting a feature if the team is willing to do so
After debugging, I found that the req.query
from Express are contains more than 20 indexes. It will convert to an object instead of an array. Which shown in a picture below.
So the validator inside transformStoreQuery
as a middleware is being executed the function will then throw an error.
I'm not sure that this is the right way, To query more than 20 products at a time. Didn't see this issue being active.
Oh! in my case i was trying calling GET /store/products
with many IDS for showing filtered product that contains 25 product per page.
Also our filtering options come from VariantOption
that is why we could not done that via API(there is not support list product from variant option) as of now.
The issue with > 20 params has been solved in #4213 and will be part of next release.
Hey, thanks for the report! Since v2 brought a lot of architectural and API changes on the backend, we will be closing this ticket since it no longer applies to our new setup, or the issue has already been fixed. If you are still facing issues with v1, please open a new ticket and we will address it as soon as possible. Thanks! 🙏
Bug report
Describe the bug
We use
medusa.products.list
heavily withid
parameter to retrieve products by IDs.But when we have too many IDs (20+) the Medusa server begins to throw an error:
I suppose this is a kind of URL length limitation. Is there any way to avoid that? Maybe I can create my own API endpoint that accepts POST but instead of using query params it's going to use body?
Expected behavior
I expect no error when I want to have products extracted by their ID.