Skip to content
Discussion options

You must be logged in to vote

Hi @ethndotsh! I'm Dosu and I’m helping the orpc team.

The error happens because Bun's File object isn't fully compatible with the Fetch API's Response constructor as used by oRPC—especially when ResponseInit options (like headers and status) are passed. oRPC's .output(z.file()) expects a WHATWG-compatible File or Blob, but Bun's File doesn't always meet those requirements, leading to the TypeError you saw.

To work around this, you can convert the Bun File to a Blob or ArrayBuffer before returning it. For example:

.handler(async ({ input }) => {
  const bunFile = await Bun.S3.file(input.id);
  const arrayBuffer = await bunFile.arrayBuffer();
  // You can use the original file name and ty…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ethndotsh
Comment options

@unnoq
Comment options

unnoq Oct 7, 2025
Maintainer

@ethndotsh
Comment options

@ethndotsh
Comment options

Answer selected by ethndotsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants