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 #51

Open
Nightmaresuwu opened this issue Sep 26, 2024 · 10 comments
Open

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

Nightmaresuwu opened this issue Sep 26, 2024 · 10 comments

Comments

@Nightmaresuwu
Copy link

i need help
image

@rajput-hemant
Copy link
Owner

Hey @Nightmaresuwu, Could you provide the steps to reproduce the issue and let me know which page or component you're seeing the error on? Any additional details or console logs would also help. Thanks!

@inthelovedotorg
Copy link

inthelovedotorg commented Oct 2, 2024

Most probably you are using the saavn wrapper either the one hemant already provided or if you've hosted yours it isn't working correctly, the issue you are encountering is because of the jio saavn api, please recheck your api and if possible host your own server for api, you can get the link to repository in one of the rajput hemant's GitHub repository

@rajput-hemant
Copy link
Owner

hey @Nightmaresuwu,
this might be due to invalid response, kindly host your own JioSaavn API server using the NODE runtime, the default Bun runtime may cause an invalid runtime error
please check the note in the README at https://github.com/rajput-hemant/jiosaavn-api-ts?tab=readme-ov-file#vercel

@Nightmaresuwu
Copy link
Author

hey @Nightmaresuwu, this might be due to invalid response, kindly host your own JioSaavn API server using the NODE runtime, the default Bun runtime may cause an invalid runtime error please check the note in the README at https://github.com/rajput-hemant/jiosaavn-api-ts?tab=readme-ov-file#vercel

still getting the same error
image

@Nightmaresuwu
Copy link
Author

hey @Nightmaresuwu, this might be due to invalid response, kindly host your own JioSaavn API server using the NODE runtime, the default Bun runtime may cause an invalid runtime error please check the note in the README at https://github.com/rajput-hemant/jiosaavn-api-ts?tab=readme-ov-file#vercel

d[auth][error] UntrustedHost: Host must be trusted. URL was: http://localhost:3000/api/auth/session. Read more at https://errors.authjs.dev#untrustedhost
at /app/.next/server/chunks/3676.js:417:47099
at nW (/app/.next/server/chunks/3676.js:417:49778)
[auth][error] UntrustedHost: Host must be trusted. URL was: http://localhost:3000/api/auth/session. Read more at https://errors.authjs.dev#untrustedhost
at /app/.next/server/chunks/3676.js:417:47099
at nW (/app/.next/server/chunks/3676.js:417:49778)
SyntaxError: Unexpected token '<', ")
at parseJSONFromBytes (node:internal/deps/undici/undici:5472:19)
at successSteps (node:internal/deps/undici/undici:5454:27)
at fullyReadBody (node:internal/deps/undici/undici:4381:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async consumeBody (node:internal/deps/undici/undici:5463:7)
at async l (/app/.next/server/chunks/5480.js:1:91753)
at async i (/app/.next/server/chunks/5480.js:1:91846)
at async l (/app/.next/server/app/(root)/page.js:1:11950) {
digest: '783189043'
}
SyntaxError: Unexpected token '<', ")
at parseJSONFromBytes (node:internal/deps/undici/undici:5472:19)
at successSteps (node:internal/deps/undici/undici:5454:27)
at fullyReadBody (node:internal/deps/undici/undici:4381:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async consumeBody (node:internal/deps/undici/undici:5463:7)
at async l (/app/.next/server/chunks/5480.js:1:91753)
at async i (/app/.next/server/chunks/5480.js:1:91846)
at async l (/app/.next/server/app/(root)/page.js:1:11950) {
digest: '783189043'
}
SyntaxError: Unexpected token '<', ")
at parseJSONFromBytes (node:internal/deps/undici/undici:5472:19)
at successSteps (node:internal/deps/undici/undici:5454:27)
at fullyReadBody (node:internal/deps/undici/undici:4381:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async consumeBody (node:internal/deps/undici/undici:5463:7)
at async l (/app/.next/server/chunks/5480.js:1:91753)
at async L (/app/.next/server/chunks/5480.js:1:94914)
at async Promise.all (index 1)
at async _ (/app/.next/server/chunks/5480.js:1:68951) {
digest: '1737552661'
}
SyntaxError: Unexpected token '<', ")
at parseJSONFromBytes (node:internal/deps/undici/undici:5472:19)
at successSteps (node:internal/deps/undici/undici:5454:27)
at fullyReadBody (node:internal/deps/undici/undici:4381:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async consumeBody (node:internal/deps/undici/undici:5463:7)
at async l (/app/.next/server/chunks/5480.js:1:91753)
at async L (/app/.next/server/chunks/5480.js:1:94914)
at async Promise.all (index 1)
at async _ (/app/.next/server/chunks/5480.js:1:68951) {
digest: '1737552661'
}
SyntaxError: Unexpected token '<', ")
at parseJSONFromBytes (node:internal/deps/undici/undici:5472:19)
at successSteps (node:internal/deps/undici/undici:5454:27)
at fullyReadBody (node:internal/deps/undici/undici:4381:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async consumeBody (node:internal/deps/undici/undici:5463:7)
at async l (/app/.next/server/chunks/5480.js:1:91753)
at async Z (/app/.next/server/chunks/5480.js:1:95005)
at async h (/app/.next/server/chunks/5480.js:1:65199) {
digest: '2347163418'
}
SyntaxError: Unexpected token '<', ")
at parseJSONFromBytes (node:internal/deps/undici/undici:5472:19)
at successSteps (node:internal/deps/undici/undici:5454:27)
at fullyReadBody (node:internal/deps/undici/undici:4381:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async consumeBody (node:internal/deps/undici/undici:5463:7)
at async l (/app/.next/server/chunks/5480.js:1:91753)
at async Z (/app/.next/server/chunks/5480.js:1:95005)
at async h (/app/.next/server/chunks/5480.js:1:65199) {
digest: '2347163418'
}
[auth][error] UntrustedHost: Host must be trusted. URL was: http://localhost:3000/api/auth/session. Read more at https://errors.authjs.dev#untrustedhost
at /app/.next/server/chunks/3676.js:417:47099
at nW (/app/.next/server/chunks/3676.js:417:49778)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/next/dist/compiled/next-server/app-route-experimental.runtime.prod.js:14:36342
at async eE.execute (/app/node_modules/next/dist/compiled/next-server/app-route-experimental.runtime.prod.js:14:27385)
at async eE.handle (/app/node_modules/next/dist/compiled/next-server/app-route-experimental.runtime.prod.js:14:37683)
at async doRender (/app/node_modules/next/dist/server/base-server.js:1419:42)
at async responseGenerator (/app/node_modules/next/dist/server/base-server.js:1652:28)
[auth][error] UntrustedHost: Host must be trusted. URL was: http://localhost:3000/api/auth/session. Read more at https://errors.authjs.dev#untrustedhost
at /app/.next/server/chunks/3676.js:417:47099
at nW (/app/.next/server/chunks/3676.js:417:49778)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/next/dist/compiled/next-server/app-route-experimental.runtime.prod.js:14:36342
at async eE.execute (/app/node_modules/next/dist/compiled/next-server/app-route-experimental.runtime.prod.js:14:27385)
at async eE.handle (/app/node_modules/next/dist/compiled/next-server/app-route-experimental.runtime.prod.js:14:37683)
at async doRender (/app/node_modules/next/dist/server/base-server.js:1419:42)
at async responseGenerator (/app/node_modules/next/dist/server/base-server.js:1652:28)

@rajput-hemant
Copy link
Owner

hey @Nightmaresuwu,

you might encounter the "untrusted host" error from authjs/next-auth when running a next.js app in production build on your local machine. If thats not the issue, please let me know.

as for the JSON parse error (SyntaxError: Unexpected token '<'), im not entirely sure what might be causing the issue, please provide steps to reproduce the issue, also here are few suggestions

  • ensure the API you're using is functional, test it with Postman or any alternative API testing tool
  • i suggest cloning the JioSaavn API repository from here and running the server locally
  • use this local API server within the Infinitunes app for your local development

let me know how it goes!

@Nightmaresuwu
Copy link
Author

hey @Nightmaresuwu,

you might encounter the "untrusted host" error from authjs/next-auth when running a next.js app in production build on your local machine. If thats not the issue, please let me know.

as for the JSON parse error (SyntaxError: Unexpected token '<'), im not entirely sure what might be causing the issue, please provide steps to reproduce the issue, also here are few suggestions

  • ensure the API you're using is functional, test it with Postman or any alternative API testing tool
  • i suggest cloning the JioSaavn API repository from here and running the server locally
  • use this local API server within the Infinitunes app for your local development

let me know how it goes!

doesent work i tried so many things

@inthelovedotorg
Copy link

hey @Nightmaresuwu,

you might encounter the "untrusted host" error from authjs/next-auth when running a next.js app in production build on your local machine. If thats not the issue, please let me know.

as for the JSON parse error (SyntaxError: Unexpected token '<'), im not entirely sure what might be causing the issue, please provide steps to reproduce the issue, also here are few suggestions

  • ensure the API you're using is functional, test it with Postman or any alternative API testing tool
  • i suggest cloning the JioSaavn API repository from here and running the server locally
  • use this local API server within the Infinitunes app for your local development

let me know how it goes!

doesent work i tried so many things

check up your jio saavn server, see if it has alll the files and folders those are in @rajput-hemant jio saavn repository.

@Nightmaresuwu
Copy link
Author

hey @Nightmaresuwu,
you might encounter the "untrusted host" error from authjs/next-auth when running a next.js app in production build on your local machine. If thats not the issue, please let me know.
as for the JSON parse error (SyntaxError: Unexpected token '<'), im not entirely sure what might be causing the issue, please provide steps to reproduce the issue, also here are few suggestions

  • ensure the API you're using is functional, test it with Postman or any alternative API testing tool
  • i suggest cloning the JioSaavn API repository from here and running the server locally
  • use this local API server within the Infinitunes app for your local development

let me know how it goes!

doesent work i tried so many things

check up your jio saavn server, see if it has alll the files and folders those are in @rajput-hemant jio saavn repository.

okay i fixed it ... thank you all but how can i add more songs? like eg i want to add serbian songs to it how can i do it? Must i implement it myself ?

@rajput-hemant
Copy link
Owner

hey @Nightmaresuwu,
thats currently not possible as this is just a wrapper around an API for a music service based in India
adding more songs from our side isnt feasible, however you could potentially add another route to the API with a separate music service behind it to include other regions

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