Skip to content

supabase function 204 fails with type error #1071

Closed
supabase/edge-runtime
#84

Description

@johanneswuerbach

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Trying to return an http 204, fails with a 500 and a TypeError in the console.

TypeError: Response with null body status cannot have body
    at initializeAResponse (ext:deno_fetch/23_response.js:202:13)
    at new Response (ext:deno_fetch/23_response.js:337:5)
    at UserWorker.fetch (ext:sb_user_workers/user_workers.js:52:16)
    at async Server.<anonymous> (file:///home/deno/main/index.ts:102:16)
    at async Server.#respond (https://deno.land/[email protected]/http/server.ts:220:24)

To Reproduce

Create function with the following:

import { serve } from 'std/server'

serve(async (req: Request) => {
  return new Response(null, { status: 204 })
})
{
  "imports": {
    "std/server": "https://deno.land/[email protected]/http/server.ts"
  }
}

Expected behavior

A 204 response without a response body.

System information

  • OS: macOS
  • Supabase CLI 1.54.5

Activity

  1. added
    bug
    on May 5, 2023
  2. self-assigned this
    on May 8, 2023
  3. laktek commented on May 8, 2023

    @laktek
    Contributor

    Thanks for opening a ticket @johanneswuerbach - will take a look.

  4. reopened this on May 18, 2023
  5. laktek commented on May 18, 2023

    @laktek
    Contributor

    We had to revert this fix as it was breaking other streaming responses (for example, Server-Sent Events)

  6. laktek commented on May 18, 2023

    @laktek
    Contributor

    Fixed in CLI 1.61.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions