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

"store/regions" endpoint returns: Unexpected token '<', "<!DOCTYPE "... is not valid JSON #354

Open
volfcan opened this issue Aug 5, 2024 · 4 comments

Comments

@volfcan
Copy link

volfcan commented Aug 5, 2024

I've setup the backend and running, specify the .env files accordingly and trying to start the storefront and came across with this error. Any idea on how to fix that?

Error [SyntaxError]: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
    at parseJSONFromBytes (file:///Users/volfcan/ZedProjects/nextjs-starter-medusa/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096)
    at successSteps (file:///Users/volfcan/ZedProjects/nextjs-starter-medusa/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096)
    at eval (file:///Users/volfcan/ZedProjects/nextjs-starter-medusa/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096)
    at <unknown> (node:internal/process/task_queues:140:7)
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  middleware: true
}

I think this is originated from this line

const { regions } = await fetch(${BACKEND_URL}/store/regions, {

in the middleware.ts file

@anubus298
Copy link

same here

@anh-nguyen-mds
Copy link

same

@a-bertrand
Copy link

a-bertrand commented Aug 12, 2024

Hello, i solve this by using the correct backend url in .env. i used the admin url (http://localhost:7001).

NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9000

@kb-0912
Copy link

kb-0912 commented Aug 27, 2024

I got the same problem.

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

5 participants