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

Unexpected end of JSON input #21

Open
totallynotdavid opened this issue Jun 27, 2023 · 0 comments
Open

Unexpected end of JSON input #21

totallynotdavid opened this issue Jun 27, 2023 · 0 comments

Comments

@totallynotdavid
Copy link

I encountered an unhandled runtime error with the message "Unexpected end of JSON input" while running the demo locally. The error occurs after successfully connecting to the Postgres database. It appears to be related to missing required environment variables KV_REST_API_URL and KV_REST_API_TOKEN in the @vercel/kv module. As I'm not familiar with Next.js and Vercel, I may be missing something crucial in my setup.

Environment:

  • Operating System: Windows 11 23H2
  • PostgreSQL Version: 15
  • Node.js Version: 18.16.0
  • Yarn Version: 3.2.1

Commands I used to start this project:

yarn
yarn product:migrations:run
yarn product:seed
yarn dev

Here's an extract from the terminal output:

[info] MikroORM successfully connected to database themedusa on postgres://postgres:*****@localhost:5432
[query] select 1 from pg_database where datname = 'themedusa' [took 5 ms]
- error Error: @vercel/kv: Missing required environment variables KV_REST_API_URL and KV_REST_API_TOKEN
    at Object.get (webpack-internal:///(sc_server)/./node_modules/@vercel/kv/dist/index.js:60:87)
    at queryProducts (webpack-internal:///(sc_server)/./src/app/api/products/route.ts:54:61)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async GET (webpack-internal:///(sc_server)/./src/app/api/products/route.ts:23:83)
    at async eval (webpack-internal:///(sc_server)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:244:37)
- error SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at AsyncResource.runInAsyncScope (node:async_hooks:203:9)

-  ┌ GET / 200 in 15205ms
   │
   └──── GET http://localhost:3000/api/products 500 in 12276ms (cache: MISS)

- error SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
digest: "4266806755"
- error Error: connect ECONNREFUSED ::1:9000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
- error Error: connect ECONNREFUSED ::1:9000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
- error Error: connect ECONNREFUSED ::1:9000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
digest: "2765090518"

Thanks in advance for the help!

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

1 participant