- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.3k
 
Closed
Description
Which project does this relate to?
Start
Describe the bug
When running with Bun as a runtime (e.g bun --bun run dev), returning a Response object from a server function throws an error.
const expectedValue = 'Hello from a server function!'
export const rawResponseFn = createServerFn().handler(() => {
  return new Response(expectedValue)
})Uncaught (in promise) Error: Invariant failed: expected content-type header to be set
    at invariant (tiny-invariant.js?v=ff4058f6:12:9)
    at getResponse (serverFnFetcher.js?v=ff4058f6:104:3)
    at async serverFnFetcher (serverFnFetcher.js?v=ff4058f6:43:12)
    at async client (createServerFn.js?v=ff4058f6:205:21)
    at async onClick (demo.start.raw-response.tsx:32:28)
See for example this e2e component. It works with node, but not Bun
Your Example Website or App
Steps to Reproduce the Bug or Issue
- Create new Start app
 - Create a component with a server function that returns a 
Response - Run dev server with Bun runtime: 
bun --bun run dev - Visit site and trigger the call to the function
 
Expected behavior
Response
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.132.7
 - OS: Linux
 - Browser: Chrome
 - Browser Version: 140
 - Bundler: vite
 - Bundler Version: 6.3.6
 - Runtime: Bun
 - Runtime Version: 1.2.22
 
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels