payload icon indicating copy to clipboard operation
payload copied to clipboard

'invalid input' error when client side uploading files to uploadthing on Vercel

Open jhb-dev opened this issue 1 year ago • 10 comments

Describe the Bug

When using client-side uploads with the storage-uploadthing package, the upload fails when hosting the payload app on Vercel. I recorded a video which demonstrates this:

https://github.com/user-attachments/assets/ecc0109c-b9fd-4496-b574-af3574432cb4

As you can see in the video, right after pressing the upload file button of the hosted version of the payload app, the request to /api/storage-uploadthing-client-upload-route fails with HTTP 400 and the return message {"message":"Invalid input"}. However, when running the same payload app locally, the uploading process works.

Link to the code that reproduces this issue

https://github.com/devj3ns/payload-uploadthing-bug-reproduction

Reproduction Steps

  1. Host the reproduction repository on Vercel (I can give you permission to the version I am hosting as a test if you want)
  2. upload a file
  3. the 'submitting' toast is shown infinitely, and the file is not uploaded

Which area(s) are affected? (Select all that apply)

plugin: cloud-storage

Environment Info

Binaries:
  Node: 20.19.0
  npm: N/A
  Yarn: N/A
  pnpm: 10.5.2
Relevant Packages:
  payload: 3.32.0
  next: 15.2.4
  @payloadcms/db-mongodb: 3.32.0
  @payloadcms/email-nodemailer: 3.32.0
  @payloadcms/graphql: 3.32.0
  @payloadcms/next/utilities: 3.32.0
  @payloadcms/payload-cloud: 3.32.0
  @payloadcms/plugin-cloud-storage: 3.32.0
  @payloadcms/richtext-lexical: 3.32.0
  @payloadcms/storage-uploadthing: 3.32.0
  @payloadcms/translations: 3.32.0
  @payloadcms/ui/shared: 3.32.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 32694
  Available CPU cores: 24

jhb-dev avatar Apr 03 '25 16:04 jhb-dev

Same on my end deploying with vercel

MakoriSM avatar Apr 04 '25 15:04 MakoriSM

I have exactly the same issue in production in Vercel but running just fine in development.

soleuil avatar Apr 11 '25 12:04 soleuil

I'm not in Vercel currently with this. But I am wiring up a backend from scratch and seeing this as well.

wayjake avatar Apr 15 '25 21:04 wayjake

I was making a POST request to my prepared url when it required PUT. Not sure if it's related, but I think I am good on my end now.

wayjake avatar Apr 15 '25 21:04 wayjake

I'm also seeing this in production, it works just fine in dev.

@markflorkowski maybe has some input on what's going on 🙏🏼

dakdevs avatar May 11 '25 07:05 dakdevs

Hi! Apologies for the long delay in getting a response here, are you still experiencing this on the latest version v3.72.0?

JessRynkar avatar Jan 20 '26 10:01 JessRynkar

Hi! Apologies for the long delay in getting a response here, are you still experiencing this on the latest version v3.72.0?

Just tried on v3.75.0, same issue

jmcapra avatar Feb 06 '26 16:02 jmcapra

Fixed by #16115 ?

andershermansen avatar Apr 08 '26 05:04 andershermansen

Fixed by #16115 ?

Yes, should be. Thanks!

r1tsuu avatar Apr 08 '26 11:04 r1tsuu

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Apr 16 '26 05:04 github-actions[bot]