Hi there, we’ve had roughly this code to work with the product picker for over a year, since migrating to the CDN AppBridge:
// inside some async function
try {
const selected = await shopify.resourcePicker({type: 'product'})
} catch (error) {
// If the user had no `read_products` permission, this would trigger.
// We notify user to ask his/her admin for the necessary permission.
}
Possible breaking change:
Yesterday, I noticed that if a user has no read_product permission it no longer raises an error. The picker opens fine but shows “No products found”. I think it would be helpful if the picker would provide some info and an actionable resolution, because “No products found” leads one to believe there’s an error with the search mechanism, not with permissions.
Possible bug:
If a user only has the “read_orders” permission, they can open the product picker and it actually shows the products. However, if they make a selection, it triggers an error that we can’t catch:
@David_Arbias, thanks for the link, but this is a slightly different problem. Also, that post likely refers to the old AppBridge version, not the evergreen version from the CDN, so they may be very different codebases by now.
The problem we have now is if the user has no read_products permission, the picker opens just fine and shows “No products found”, whereas not long ago, in the very same CDN “version”, it used to reject the promise. This is what I refer to as the breaking change.