pingdotgg / uploadthing

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

[bug]: express adapter breaks when using `body-parser` #590

Open juliusmarminge opened 7 months ago

juliusmarminge commented 7 months ago

Provide environment information

System:
    OS: macOS 14.2.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 106.48 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.0 - ~/Library/Caches/fnm_multishells/30733_1706613602105/bin/node
    npm: 10.2.4 - ~/Library/Caches/fnm_multishells/30733_1706613602105/bin/npm
    pnpm: 8.14.1 - ~/Library/Caches/fnm_multishells/30733_1706613602105/bin/pnpm
    bun: 1.0.25 - ~/.bun/bin/bun
  Browsers:
    Chrome: 121.0.6167.85
    Safari: 17.2.1
  npmPackages:
    typescript: ^5.3.3 => 5.3.3

Describe the bug

this breaks:

CleanShot 2024-01-30 at 09 32 33@2x

move the bodyparser middleware below the uploadthing route handler to fix it. the new logs helps narrow down the issue but we can probably make this scenario work

Link to reproduction

๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡

To reproduce

see #586

Additional information

No response

๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributing

Code of Conduct

juliusmarminge commented 7 months ago

if anyone using express would like to take a deeper dive feel free - I probably wont spend time on this for a while unless it becomes a higher priority issue

probably just needs a check to see if body is already parsed then use that - else parse it manually

MustafaEminn commented 3 months ago

The issue cannot be reproduced anymore