Summary
Calling Supabase edge functions from Weweb has been working fine until a few weeks back when the CORS issues started to happen, without any changes to the edge function code. Only restarting the browser/device solves it, just for the errors to appear again after a few days/tries. Errors happen only on Firefox production, to random people, me and some of my team members included.
Issue description
The error happens so randomly - either CORS Missing Allow Origin, CORS Failed or Cross-Origin Request Blocked. I already handled the CORS response for both OPTIONS and POST requests in the edge functions, and they have been working without problems until a few weeks back. The edge functions run just fine on Supabase side, no errors in logs.
Our test cases
- Call the edge function API one, after the edge function is done running, then call it again (this is our typical use case). 80% of the errors appear on the second call. 20% appear on the first call. No error on Chrome and Safari.
- Access the website from multiple tabs, and call the edge function from one of the tabs: Firefox always throws an error. No error on Chrome and Safari.
- Call the edge function when ad-blocker add-ons and/or applications are active/inactive: CORS Missing Allow Origin error appears when I enable a specific add-on on Chrome, which is resolved when I disable it. Well, Chrome and Safari work well most of the time. As for Firefox, ad-block or no ad-block, the errors still happen randomly.
I now believe that this is probably a Weweb-Firefox compatibility issue. Any idea to work around this? I don’t want to tell my users to not use Firefox