baptisteArno / typebot.io

💬 Typebot is a powerful chatbot builder that you can self-host.
https://typebot.io
Other
6.93k stars 1.88k forks source link

[Bug] SyntaxError: Unexpected token 'I', "Internal S"... is not valid JSON #1644

Open fgasklgo239 opened 1 month ago

fgasklgo239 commented 1 month ago

I have a VPS on Digital Ocean where I'm running typebot-viewer, and randomly as the chat doesn't start.

The viewer logs in docker:

Something went wrong SyntaxError: Unexpected token 'I', "Internal S"... is not valid JSON
    at JSON.parse (<anonymous>)
    ... 8 lines matching cause stack trace ...
    at async E (/app/apps/viewer/.next/server/pages/api/[...trpc].js:222:3958) {
  code: 'INTERNAL_SERVER_ERROR',
  name: 'TRPCError',
  [cause]: SyntaxError: Unexpected token 'I', "Internal S"... is not valid JSON
      at JSON.parse (<anonymous>)
      at parseJSONFromBytes (node:internal/deps/undici/undici:4306:19)
      at successSteps (node:internal/deps/undici/undici:4288:27)
      at fullyReadBody (node:internal/deps/undici/undici:2724:9)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async consumeBody (node:internal/deps/undici/undici:4297:7)
      at async m (/app/apps/viewer/.next/server/chunks/595.js:1:2990)
      at async E (/app/apps/viewer/.next/server/chunks/595.js:1:1184)
      at async /app/apps/viewer/.next/server/pages/api/[...trpc].js:222:7333
      at async E (/app/apps/viewer/.next/server/pages/api/[...trpc].js:222:3958)
}

Firstly, this situation happened more frequently at Vercel, so I thought that was the problem. I switched to Digital Ocean thinking it might be something related to lambda, so I hired a VPS.

Then I thought it could be the traffic, but few people access it per day, my Digital Ocean machine doesn't reach close to 80% usage of any of the resources.

My database is on RDS (AWS) and working normally.

For some reason, it happens a lot when I open the site in an anonymous tab. (I don't know what could influence it)

Sending the request to start the chat via insomnia, whenever more than 10 seconds passes, the error returns: 349193780-9d361acc-4828-4692-be80-c38489f20f5d

Sending the same thing a few seconds later returns successfully: image

I have no idea what it could be :/

baptisteArno commented 1 month ago

Maybe try to add more resource to your VPS? I have no idea what can cause this...