Intermittent Network Error on Weweb + Supabase

Hello,

When I use Weweb to trigger a REST API request to a Supabase Edge function, I get this error on Weweb Console logs but only intermittently. It works sometimes but does not work other times without following any pattern

name: “Error”
stack: “Error: Network Error at e.exports (https://editor-cdn.weweb.io/public/js/chunk-vendors.792b3bba.js:1:120680) at _.onerror (https://editor-cdn.weweb.io/public/js/chunk-vendors.792b3bba.js:1:115642) at XMLHttpRequest.sentryWrapped (https://browser.sentry-cdn.com/7.45.0/bundle.min.js:2:38971)”
message: “Network Error”
response: undefined
isAxiosError: true

Upon inspecting with Chrome Devtools, I get this message:

'https://data.weweb.io/designs/caa6097e-f423-4edb-b7f4-99cb433526f3/rest-api/request' from origin 'https://editor.weweb.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I have also followed the steps here but it did not help: CORS (Cross-Origin Resource Sharing) support for Invoking from the browser | Supabase Docs

Hi @pravictor :wave:

I think you might have a couple of options.

Since you’re using the REST API plugin to make a request, you could simple toggle the option to “Proxy the request to bypass CORS issues” (see docs here)

Otherwise, if you want to use our native Supabase “Invoke Edge function” action, you would indeed need to add some code to your function (see example here).

Let me know if that helps. If not, can you share the code of your function so we can check if it’s something in the logic of the code to handle CORS that’s not quite right?