Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Edge function with non 200 response doesn't include response body #51

Description

@KirioXX

Bug report

Describe the bug

When I try to return an error response I get this error:

FunctionsHttpError: Edge Function returned a non-2xx status code

but the response body that I sent from the function is not included.

I try to return the error like this:

...
} catch (error) {
    return new Response(JSON.stringify({
      error: error.message
    }), {
      headers: { ...corsHeaders, 'Content-Type': 'application/json' },
      status: 500,
    })
  }

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Setup a new edge function with a non 200 response
  2. Start function local
  3. try to call the function via the supabase sdk
  4. See the error

Expected behavior

I expected to get the error message back that I set in the response body.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: macOS
  • Browser: chrome
  • Version of supabase-js: 2.8.0
  • Version of Node.js: 19.6.0

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions