data.json requests in vercel are being returned truncated resulting in invalid JSON responses, which causes the page to crash every time.
It works perfectly running the local build but fails on Vercel. I also tried old preview deployments where my pages were previously working and am experiencing the same issue.
Hi @alexcyphus. I haven’t found any similar reports yet, but it’s possible you were among the first to uncover this potential bug. Can you share a minimal reproducible example or some project details that would let us repro and investigate?
I have a NextJS 13 Server (Haven’t had time to update to 14 + I like the pages router better than the app router) which has a page that uses getStaticProps and uses ISR.
We noticed a problem recently where some static pages that are loaded using a shallow reroute (i.e. clicking on a Link component) load the static props all as undefined, which causes pages that are not typechecked to expect those values as undefined to crash.
What’s weird is if you check the network tab, it shows that the static props JSON files are being loaded but requested multiple times, but they are incomplete JSONs. It’s as if some system is taking in a JSON as a string and truncating the string. The length of truncation appears somewhat random, and the data that is printed before the truncation is all completely correct, so I think getStaticProps is working properly. I can also verify that it is the actual statically served JSON file that is not loading correctly, because if you go to the URL in your browser this is what shows up:
We can also run it perfectly fine in production mode locally (pnpm build && pnpm start) without this problem, so I think we are doing something wrong when actually deployed to Vercel’s servers or we are hitting some limit that we don’t know about. There aren’t that many pages that are ISR’d in this way so I would be surprised if we’re hitting some total file size limit.
Any and all help would be appreciated, and thanks in advance!
I didn’t change anything, but it magically started working again last night! Haven’t had any issues with it since - very strange though because between it being broken and working again I didn’t touch anything. Thanks for the help!
I’m happy to hear it’s working for you! I shared this thread with the engineering team and we’ll watch for any similar issues that could be intermittent. Please let us know if you see the same issue again.