ai-chatbot icon indicating copy to clipboard operation
ai-chatbot copied to clipboard

Unexpected token 'e', "error code: 1016" is not valid JSON

Open javidjamae opened this issue 1 year ago • 3 comments

I just deployed the app to Vercel to play around with it, and I've made no changes to the code. It seems to work at first because I can interact and get responses to queries that appear. But when I'm just sitting on the application without doing anything, it will suddenly go to an error screen with:

Application error: a server-side exception has occurred (see the server logs for more information).
Digest: 956933652

Then when I inspect the error logs I see the following error:

SyntaxError: Unexpected token 'e', "error code: 1016" is not valid JSON
    at (node_modules/.pnpm/@[email protected]/node_modules/@upstash/redis/chunk-JIU2S2DZ.js:1:2666)
    at (node_modules/.pnpm/@[email protected]/node_modules/@upstash/redis/chunk-JIU2S2DZ.js:1:4078)
    at (app/api/chat/route.ts:56:6)
    at (node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/ai/dist/index.mjs:49:8)
image

For context, I did initially deploy this to a hobby Vercel account and then ported it over to a Team that is on the Pro Trial. I'm not sure if that could have anything to do with the way that it accesses the KV store on top of Redis.

Any help would be greatly appreciated.

-- Update:

I completely deleted the project in Github and in Vercel and deployed again to the team (adding the Vercel KV / Stash back in within the new project), and I still get the exact same error. I'm wondering if this is reproducible by merely going through a standard installation, using the current code. I didn't do anything out of the ordinary, I just followed the installation/deployment instruction.

javidjamae avatar Dec 08 '23 02:12 javidjamae

+1. Experiencing the exact same error, I just deployed it to Vercel in a team account.

vivekrp avatar Dec 08 '23 07:12 vivekrp

Interestingly, today I ran it locally and it all worked fine, then I went back to the deployed version (with absolutely no changes) and it no longer crashes.

Two concerns here:

  1. There is some sort of underlying issue with the way the KV store is accessed
  2. The fallback behavior when the app gets an error is to show a "white screen of death" as opposed to just logging the error or asking the user to refresh the chat. It would be nice if error handling was more graceful.

Feel free to close this issue out, but it seems like some investigation and improvements could be made here.

javidjamae avatar Dec 08 '23 21:12 javidjamae

Potentially cloudflare blocking your requests from Vercel

anton-series avatar Nov 08 '24 21:11 anton-series