Failed to Fetch Errors when waiting on database queries - The stack trace is: TypeError

I am fetching 3rd party API data and importing it into supabase. Locally, I do not get these errors, even while connected to the production database. I chunk the data and use promises mixed with prisma transactions to optimize the fetching.

I also get this error on application pages that require larger database queries (dashboards analytics).

These fetch requests actually continue to run, even though they trigger the Remix.run Error Boundary.

The logs do not provided any insight on why I continue to get “Failed to fetch” errors. I go into the monitoring section on fly.io before and after I run into these issues and there are not any errors.

I also have Sentry setup and no errors are reported there either.

The pages with the issues are pulling large amounts of data from Supabase. I have looked at the Query Performance in Supabase and the most time consuming query takes 55458.91ms.

I have been testing this locally with the production database and yes, some of the larger queries that pull a lot of data can take 20+ seconds to pull the data and do the computations, but I do not get any “Failed to fetch” errors locally.