SalesforceCommerceCloud / sfcc-sample-apps

Salesforce Commerce Cloud Sample Apps
BSD 3-Clause "New" or "Revised" License
122 stars 69 forks source link

Search not working for sfcc-sample-apps #247

Closed asadkhawaja1 closed 4 years ago

asadkhawaja1 commented 4 years ago

I have followed the steps to set up the sample application sfcc-sample-apps.

After starting the App and opening http://localhost:3000 when I click on "Shop Now" or any other link which should redirect to http://localhost:3000/search/Tops , http://localhost:3000/search/Ties or http://localhost:3000/search/Coats

I am getting this on Page

**No results for coats.

Search Tips:

Double-check spelling. Change your search query. Be less specific.**

while there is no any error in the terminal.

jbegleiter-sf commented 4 years ago

Hey @asadkhawaja1 ,

Could you post the request body and header please (without your client secret/short code)?

Cheers, Josh

asadkhawaja1 commented 4 years ago

Request URL: http://localhost:3000/api Request Method: POST Status Code: 200 OK Remote Address: [::1]:3000

POST /api HTTP/1.1 Host: localhost:3000 Connection: keep-alive Content-Length: 995 content-type: application/json Origin: http://localhost:3000 Sec-Fetch-Site: same-origin Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty Referer: http://localhost:3000/search/Tops

{"operationName":null,"variables":{"query":"Tops","filters":[]},"query":"query ($query: String!, $filters: [Filter]) {\n productSearch(query: $query, filterParams: $filters) {\n productHits {\n productId\n productName\n prices {\n sale\n list\n typename\n }\n image {\n title\n link\n alt\n typename\n }\n colorSwatches {\n name\n value\n title\n link\n alt\n style\n typename\n }\n typename\n }\n sortingOptions {\n id\n label\n typename\n }\n refinements {\n values {\n label\n value\n hitCount\n values {\n label\n value\n hitCount\n typename\n }\n typename\n }\n label\n attributeId\n typename\n }\n currentFilters {\n id\n value\n typename\n }\n typename\n }\n}\n"}

{"errors":[{"message":"Cannot read property 'title' of undefined","locations":[{"line":2,"column":3}],"path":["productSearch"],"extensions":{"code":"INTERNAL_SERVER_ERROR","exception":{"stacktrace":["TypeError: Cannot read property 'title' of undefined"," at new Image (D:\Work\Salesforce\Sample Apps\sfcc-sample-apps\packages\@sfcc-bff\productapi\src\api\models\Image.js:11:28)"," at new SearchResultProduct (D:\Work\Salesforce\Sample Apps\sfcc-sample-apps\packages\@sfcc-bff\productapi\src\api\models\SearchResultProduct.js:48:22)"," at D:\Work\Salesforce\Sample Apps\sfcc-sample-apps\packages\@sfcc-bff\productapi\src\api\models\SearchResult.js:17:34"," at Array.map ()"," at new SearchResult (D:\Work\Salesforce\Sample Apps\sfcc-sample-apps\packages\@sfcc-bff\productapi\src\api\models\SearchResult.js:16:37)"," at productSearch (D:\Work\Salesforce\Sample Apps\sfcc-sample-apps\packages\@sfcc-bff\productapi\src\api\schema\productSearchResolvers.js:80:24)"," at processTicksAndRejections (internal/process/task_queues.js:97:5)"]}}}],"data":{"productSearch":null}}

asadkhawaja1 commented 4 years ago

can this help?

jbegleiter-sf commented 4 years ago

hey @asadkhawaja1 ,

Can you send me the config you have used also private ( jbegleiter AT salesforce DOT com)? I am guessing there is some issue in the config, which is why you are seeing an ISE.

Cheers, Josh

asadkhawaja1 commented 4 years ago

sure @jbegleiter-sf I will email you in a while.

Thanks.