pingdotgg / uploadthing

File uploads for modern web devs
https://uploadthing.com
MIT License
3.74k stars 267 forks source link

[bug]: Bun does not work with upload with url #795

Closed samyarkd closed 2 months ago

samyarkd commented 2 months ago

Provide environment information

System:
    OS: Linux 5.10 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13650HX
    Memory: 11.08 GB / 15.44 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.15.4 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
    bun: 1.1.7 - ~/.bun/bin/bun
  npmPackages:
    uploadthing: ^6.10.3 => 6.10.3

Describe the bug

when i try to upload a file with the url with the latest version of bun in my case 1.1.7 it throws an error:

 bun run index.ts 
943 |             ...options,
944 |             type: options?.type ?? (lookup(name) || "application/octet-stream"),
945 |             lastModified: options?.lastModified ?? Date.now()
946 |         };
947 |         super(parts, optionsWithDefaults);
948 |         this.name = name;
                  ^
(FiberFailure) TypeError: Attempted to assign to readonly property.
      at new UTFile (/home/bun_test/node_modules/uploadthing/server/index.js:948:13)

Link to reproduction

https://stackblitz.com/edit/github-dky9xj?file=src%2Fserver%2Fuploadthing.ts

To reproduce

Run the server file with bun

Additional information

No response

πŸ‘¨β€πŸ‘§β€πŸ‘¦ Contributing

Code of Conduct

juliusmarminge commented 2 months ago

This is an upstream bug in Bun: https://github.com/oven-sh/bun/issues/10178. Please upvote the issue there to bring some attention to the Bun team

samyarkd commented 2 months ago

@juliusmarminge should i replace blob with 'Bufferor wait? using something likepatch-package`