© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
4 replies
TheManWithNoPlan

CORS enabled Edge function example in the Supabase docs throwing error when invoked

Hey everyone, since a couple of days we were getting a CORS error in an application that we developed. Worked like a charm before.

I decided to spin up a new Supabase project following the official docs and see if this problem persists. Unfortunately it does.

Steps to reproduce the error:
1. create an empty app following the Vite + React quick start guide(https://supabase.com/docs/guides/getting-started/quickstarts/reactjs).
2. create a hello-world Edge function and use the code in the CORS guide(https://supabase.com/docs/guides/functions/cors).
3. deploy the function using the Supabase CLI(https://supabase.com/docs/guides/functions/deploy).

Invoking the function from the app sometimes works, but sometimes it throws a CORS error, even though it then returns the data from the function. Refreshing the page a couple of times causes the CORS error to be thrown.
But this inconsistency breaks our production app.

Attaching a couple of screenshots with the code used.
Created a public repo with the code that causes the error. https://github.com/PaulMacinic/supabase-demo-cors
Also, deployed the frontend in the repo to Vercel. See here: https://supabase-demo-cors.vercel.app/

Tested on latest Chrome on Mac OS and latest Chrome on Windows.

Any idea would help a lot. Thanks!
Screenshot_2023-12-17_at_00.51.13.png
Screenshot_2023-12-17_at_00.56.15.png
Screenshot_2023-12-17_at_00.54.13.png
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

CORS + Auth Header Error: Supabase Edge Function from Lovable Frontend
SupabaseSSupabase / help-and-questions
4mo ago
[NEED HELP] Edge function throwing this error intermittently
SupabaseSSupabase / help-and-questions
6mo ago
Supabase edge function issue
SupabaseSSupabase / help-and-questions
3w ago
Edge function cors issue with hono
SupabaseSSupabase / help-and-questions
4mo ago