- In my React app, I am currently facing an issue where randomly, every once in a while, a call returns an error to the website instead of the data from the call to Supabase. I am having a difficult time debugging it. Supabase shows that it is not failing on its side. Every time it happens I am logging the error, but I still can’t really figure out a reason for the bug. My app is also deployed as a static web app with Azure if that helps at all. It seems to happen randomly for all my API calls. It is not quite evenly distributed amongst them. Any and all help would be much appreciated. It’s very weird that the API calls work most of the time, but produce an error every once in a while. If the proportion of errors was lower I would maybe ignore but it seems like I get about 80 or so errors a day for about 1200 people using the site in the same day. Also, I am on the free Supabase plan if that might factor in. I’ll put my compute usage at the bottom.
Here is a code snippet for one of the calls (they are all quite similar but some call Supabase functions instead):
const { data, error } = await supabase
.from('all_questions')
.select('*')
.eq('day', formattedDate);
if (error) {
console.error('Error fetching data:', error.message);
report_error(userID, "read current question", error.message, (Date.now() - sessionStart) / 1000, String(formattedDate), JSON.stringify(data));
throw error;
}
setTodaysData(data);
console.log("Data fetched successfully!");
(report_error() is a function that inserts an error log into supabase so I can track them)
Here is the information I log when an error occurs:
my error logging
Error distribution:
error distribution
Here is Supabase error tracking showing no errors:
supabase error log
Supabase compute usage:
Memory: 45%
Swap: 20%
Average CPU: .6%
Max CPU: 1.76%
Disk IO: 1%
I have tried researching what the error message means but I can’t find too much on it specifically. Can’t think of what might cause it. I expect the API call to Supabase to return data, but it is producing an error randomly.
isaac is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.