Cloudflare randomly cuts JSON response to empty array (and sets accept-ranges header)

Hi,

since a few days ago Cloudflare seems to randomly cut the JSON responses from my AWS Lambda API to an empty array. This is really strange, and seems to happen randomly, and completely kills the app because I don’t expect this to happen.

If I reload the same request in another window, I get the JSON response back just fine. Just the initial request is cut to just [].

Besides the bugged empty [] response, I also notice that Cloudflare sets the header accept-ranges: bytes (which it does not need to do - does Cloudflare somehow cut this file?!).

If I wait about 1-2 minutes, and then do the same request on the page again, it returns the correct JSON response.

Does someone else have this issue? This is really weird and unexpected!

Are you able to share the direct URL to the JSON file?

Yes, it happens for all API URLs. Here’s one I can share where it just happened.

Ok, I have checked it and it immediately was served from Cloudflares Cache. But also when bypassing the JSON is not getting served empty. Please monitor your JSON file and when it happens again please post the full header so we can inspect.

Here’s another one. Response is just [].

Please keep an eye on:

As this means it was not served from Cloudflares Edge, but instead proxied from the origin. So Cloudflare got this JSON file like this. For future [] responses please check this header.
Of course Cloudflare will not also cache this empty-array file as it was a 200-response but Cloudflare pretty sure did not modify this JSON file.

Good catch, maybe this is an issue on our side. I’ll go over the books again :+1:

1 Like

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