medusa icon indicating copy to clipboard operation
medusa copied to clipboard

Requested fields [store] are not valid` when getting a store product

Open kevinrobert3 opened this issue 10 months ago • 6 comments

Bug report

Describe the bug

I had extended the allowed fields for store to include additional fields like

imports.allowedStoreProductsFields = [ ...imports.allowedStoreProductsFields, "store_id", "store.store_handle", "store.name", "store.store_logo", "store.store_cover", ]; This was working perfectly

I did an upgrade of medusa 3 days ago from v1.20.2 to v1.20.4 and that has not been working since then. I get error Requested fields [store] are not valid when getting a product.

Downgrading medusa to v1.20.2 works perfectly.

Basically a push was made that broke existing functionality and it is not in the changelog.

System information

Medusa version (including plugins): 1.20.4 Node.js version: v20 Database: postgres Operating system: MacOS Browser (if relevant): Chrome

Steps to reproduce the behavior

  1. Upgrade to v1.20.4
  2. Extend allowed store products fields to have an additional field
  3. Get the product via store/products endpoint
  4. You will get error Requested fields [yourfield] are not valid

Expected behavior

A product is returned including the additional field

kevinrobert3 avatar Apr 02 '24 13:04 kevinrobert3

same thing happened for me, it happens only in the ..Store...fields not on ...Admin..fields, this also happened when adding the plugin medusa-custom-attributes

sid0dz avatar Apr 02 '24 14:04 sid0dz

Can you try to include store in the extended allowed fields?

olivermrbl avatar Apr 02 '24 15:04 olivermrbl

@adrien2p, this might have to do with #6647

olivermrbl avatar Apr 02 '24 15:04 olivermrbl

Ill have a look

adrien2p avatar Apr 02 '24 15:04 adrien2p

Also @olivermrbl shouldn't we document the new way of overriding the allowed fields?

adrien2p avatar Apr 02 '24 15:04 adrien2p

This pr will generate a snapshot version that you should be able to test 💪

adrien2p avatar Apr 02 '24 16:04 adrien2p

Adding store field entirely works, i.e no error. But we would not want to add it entirely, as a security precaution. We would like only certain fields e.g store_handle, logo etc which are in the store field

kevinrobert3 avatar Apr 03 '24 04:04 kevinrobert3

@kevinrobert3 it should be good

adrien2p avatar Apr 03 '24 09:04 adrien2p

Will be live in the next version right? @adrien2p

kevinrobert3 avatar Apr 03 '24 14:04 kevinrobert3