JSON responses being truncated

It seems as though there may have been a regression to this issue: JSON responses being truncated at approx. 60Kb · vercel · Discussion #3291 · GitHub

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.

Example:
(this can also be reproduced by going https://www.deutschdictionary.com/ and looking up any word using the search bar)

    "pageProps": {
        "enToDe": {
            "translations": [
                {
                    "possiblePrefixes": [],
                    "toLanguage": "de",
                    "examples": [
                        {
                            "de": "Der Wombat lebt in Australien.",
                            "en": "The wombat lives in Australia.",
                            "id": "98ba1176-9e9b-4338-ac89-8ce7750468cb"
                        }
                    ],
                    "pageViews": 0,
                    "fromLanguage": "en",
                    "partOfSpeech": "noun",
                    "nounGender": "m",
                    "translation": "Wombat",
                    "fromLanguageWord": "wombat",
                    "id": "74177084-1ef1-4f65-8852-d3da0ade746b",
                    "source": "ai",
                    "explanation": "Australian burrowing marsupial"
                }
            ],
            "exampleS

Steps to Reproduce

  1. Go to https://www.deutschdictionary.com
  2. Look up any word using the search bar
  3. Look at the JSON data requested in the network tab for that word
  4. See that it is cut off resulting in invalid JSON

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?

Hi! Thanks for the reply.

I am away from my computer at the moment but I found someone experiencing a similar issue with a minimal reproduction.

I believe the example from joslarson is the same issue.

I can also prepare my own example this wekeend if helpful. Please let me know any other information that would be helpful.

Thanks!

Alex

1 Like

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!

Hey @mccesium-gmailcom. It looks like you’re experiencing the same issue as @alexcyphus so I moved your post into the existing conversation.

1 Like

Hey just confirming this looks like the same issue as mine and I also experienced this issue testing both on Next 13 + Next 14.

Some other debugging via the Vercel settings I tried

  • Deleting my entire Vercel project and creating a new one
  • Changing the node version from 20 => 18
  • Changing the function region from US => Frankfurt

None of which helped unfortunately

@alexcyphus I’m getting the full JSON response for searches on https://www.deutschdictionary.com/ now. Did you find a solution?

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!

1 Like

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. :pray:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.