adobe / storefront-product-listing-page

MIT License
14 stars 32 forks source link

Error with search.js (v1.1.0): 'Client ID is invalid' #22

Open allforcode opened 6 months ago

allforcode commented 6 months ago

Actual Behaviour

I followed the instructions provided in the README to build search.js version 1.1.0 for a Magento website. However, when I integrated the file into the website, I encountered an error stating 'Client ID is invalid.' from the request https://catalog-service-sandbox.adobe.io/graphql

Interestingly, I noticed that there is no issue when using the version v1.0.4, which comes from the URL https://plp-widgets-ui.magento-ds.com/v1/search.js.

Could there be issues in v1.1.0 that are not present in v1.0.4?

Expected Behaviour

Search.js should function without errors and provide the expected search functionality on the website.

Steps to Reproduce

  1. Build search.js by running npm run build.
  2. Integrate search.js into a website, which is Magento in my case.
  3. The search result page is blank and the endpoint https://catalog-service-sandbox.adobe.io/graphql returns an error message 'Client ID is invalid'.
    {
    "error": {
        "code": "Forbidden",
        "message": "Client ID is invalid",
        "details": {
            "error_code": "403003"
        }
    }
    }

Platform and Version

Adobe Magento Commerce ver. 2.4.7

MichaelHeinzman commented 6 months ago

I'm not sure if this will be helpful but when I forked the project and tried to use search.js, I had to change the following line in store.tsx. They changed this in the recent version. I'm not sure if I got the same error you did, but that was the only issue I had about two months ago.

environmentType?.toLowerCase() === 'testing' && !apiKey ? SANDBOX_KEY : apiKey

to

environmentType?.toLowerCase() === 'testing' ? SANDBOX_KEY : apiKey
allforcode commented 6 months ago

Thank you for your help and solution! Your advice was very useful. With the change, I managed to fix my problem. I really appreciate your expertise. Thanks again!

shiftedreality commented 5 months ago

Thanks for raising this; I've created an internal ticket, MSRCH-4621, to address the issue.

benjaminkalk commented 3 months ago

The fix is going in with other v2 feature set, and should be merged soon. https://github.com/adobe/storefront-product-listing-page/blob/feature/v2/src/context/store.tsx#L77

nerell-2 commented 1 month ago

I have made the updates as mentioned in the posts but I still get the same issue, any ideas? @allforcode @MichaelHeinzman