© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
BoogersLLC

Return Error from Edge Function

Hello,

I'm trying to return a custom error from an edge function.

You can see in the screenshot attached I can return the response as a 500. However, I don't understand how to throw an error so that the supabase
invoke
invoke
function catches the error (and then populates
error
error
instead of
data
data
)

I'm also pretty confused because if I try to just
throw new Error('some error')
throw new Error('some error')
instead of returning a response, I get a CORS Policy block. So it seems like I must return a response with my CORS headers, but then I'm not sure how to return an error at that point?

I'm also a total Deno noob, so I may be missing something really obvious here.
unknown.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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to return an error from an edge function
SupabaseSSupabase / help-and-questions
4y ago
42P01 error from edge function
SupabaseSSupabase / help-and-questions
4mo ago
Query table from edge function
SupabaseSSupabase / help-and-questions
4y ago
Invoking Edge Function from Browser
SupabaseSSupabase / help-and-questions
4y ago