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

SyntaxError: Unexpected token < in JSON at position 0 #288

Open
mfaeezshabbir opened this issue Mar 15, 2024 · 6 comments
Open

SyntaxError: Unexpected token < in JSON at position 0 #288

mfaeezshabbir opened this issue Mar 15, 2024 · 6 comments

Comments

@mfaeezshabbir
Copy link

mfaeezshabbir commented Mar 15, 2024

I am trying to access the storefront of medusa app but i end up getting this error every time, could you please help me

image

@VariableVic
Copy link
Collaborator

Hey @mfaeezshabbir, is you Medusa server running on localhost:9000? If it's running on a different port or domain, make sure to update the NEXT_PUBLIC_MEDUSA_BACKEND_URL env variable.

@mfaeezshabbir
Copy link
Author

Hey @mfaeezshabbir, is you Medusa server running on localhost:9000? If it's running on a different port or domain, make sure to update the NEXT_PUBLIC_MEDUSA_BACKEND_URL env variable.

Yes it was on port 9000 but this error is from the storefront

@wahidbabar
Copy link

facing same issue @mfaeezshabbir @VariableVic Medusa backend is running on PORT: 7001, changed it in frontend .env, still giving same error

@lacymorrow
Copy link

The issue is most likely a CORS issue on the backend (dealt with it in production today).

Make sure the STORE_CORS variable is being set properly in your env and medusa-config.js

@reiser
Copy link

reiser commented Sep 13, 2024

pretty sure its caused by wrong config pointing admin to backend:
NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:7001
it should be on local
NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9000

@maacaron
Copy link

maacaron commented Nov 7, 2024

I was facing the same problem with a fresh project. And while searching for a solution I looked into medusa config - there are process.env.XYZ vars. And I forgot to export them via console. After export $(grep -v '^#' .env.local | xargs) in storefront catalog it works like a charm.

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

6 participants