Need Support: Netlify functions sometimes receiving corrupted JSON despite valid json being sent. We've made no changes, this error is seemingly out of nowhere

My site seems to have a similar problem. I have been receiving frequent function timeouts since 1/31/24. Error logs do not provide good information.

Function is a graphql function tied to Railway database. I thought it might be Railway, but I have set up using Supabase and still get the same errors.

Eduardo,

Thank you again for your support and time.

I’m not sure how easy it will be to generate a non-expiring JWT or create a simpler reproduction case. The easiest solution I can think of would be to just repeatedly provide you new JWTs (ours expire every 60 minutes I believe).

For now, however, I can confirm that the error still occurred at 7:51AM Pacific time today (though as of 8:17 I’ve been struggling to catch an instance of it).

Thank you again.

We have also turned off a feature flag (which was only active for Starter users) that we think might be related. But we are still waiting to make a meaningful progress here as people who are reporting the issue have not yet shared (except @slept) the details of their sites and proper reproduction steps.

i can confirm i havent been able to reproduce the issue as well after you turned off the feature.

1 Like

My site also seems to be working better.

1 Like

If you could turn on the feature for a specific site only, I could probably spin up a test site to replicate the issue and give you the details.

1 Like

@skippyyy, thank you for the offer, we would really appreciate that. Please setup a site and let us know its ID so we can enable the flag for that. Then also let us know how we can confirm the corrupted JSON (like would you be logging it somewhere, or would your API be returning it as a response, etc.).

Hello, the site ID is celebrated-panda-8e0d08. Let me know when the feature is enabled on the site so I can provide you with further details/instructions.

Awesome, that site has been opted it. We would be awaiting your report…

Okay so, I was able to replicate it by just going to https://celebrated-panda-8e0d08.netlify.app/ and just spamming the trigger button like 5 times in a row really quick, after a few tries you should be able to see a few 5xx responses with json parsing error. I have logging enabled and a middleware in my express server that console logs the payload before it’s passed to the json parser, and it seems like there’s an extra “}” at the end of each payload but i’ve seen some other weird behaviour before like missing quotes etc. Let me know if you were able to replicate the issue or if you need any more details!


2 Likes

I can verify that I haven’t encountered the issue again since you disabled the feature.

Can you provide a reproduction and site id please?

This should now be fixed for all. @skippyyy thank you so much for the reproduction, the devs really found that useful!

1 Like

Hey @hrishikesh did we recently enable back the flag, we started seeing the corrupted json errors again. It showed up but disappeared after you turned off the flag last time. Thanks!

Yes the flag was enabled because the devs fixed this issue. If this is still happening for you could you please share your site name?

Haven’t seen any problems on our site but will let you guys know if we do.

it’s utopic-ai, thanks @hrishikesh

Where do I set that exactly?

Could you also share a way to reproduce this like @skippyyy did?