Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search does not work (possible routing/API issue). #194

Open
s-c-p opened this issue Sep 30, 2021 · 3 comments
Open

Search does not work (possible routing/API issue). #194

s-c-p opened this issue Sep 30, 2021 · 3 comments

Comments

@s-c-p
Copy link

s-c-p commented Sep 30, 2021

Bug report

Describe the bug

On localhost:3000 or http://localhost:3000/s/1 typing anything in the search bar leads to

Unhandled Runtime Error

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

at http://localhost:3000/search?q=a

or if the search query contains spaces, like on http://localhost:3000/search?q=a%201 we see:

Server Error

FetchError: invalid json response body at http://localhost:3000/api/search?q=a%201&_includeAppData=1 reason: Unexpected token I in JSON at position 0
This error happened while generating the page. Any console logs will be displayed in the terminal window.

at pages/_app.js (54:16) @ async Function.MyApp.getInitialProps

To Reproduce

Steps to reproduce the behavior:

  1. just follow steps at https://docs.reactstorefront.io/guides/getting_started for version 8.18.3
  2. Open the localhost in the browser and try searching a or a 1

Expected behavior

The search results page should be displayed even if no hits were found.

System information

  • OS: Kubuntu 20.04
  • Browser firefox esr
  • Version of React Storefront: [e.g. 8.18.3]
@s-c-p
Copy link
Author

s-c-p commented Sep 30, 2021

I tried an earlier version also, I guess the [...subCategory].js API is getting mangled with search API? IDK..

@ahmad-reza619
Copy link

I think the issue is in this line

filters = JSON.parse(filters)
, the filters on param probably is not null at all but it's not a valid json

@ScyDev
Copy link

ScyDev commented Dec 8, 2021

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants