UploadThing is not working on a production
Hello, I have an app in Typescript and NextJS 14.
UploadThing is working correctly on dev, but when I build my app and start it it is not working. I'm not really sure why.
When I upload an image on dev, it sends a fetch and the response is data as url and etc.
But when I do the same on production, I never receive a response and the fetch fails in like 1 minute... BUT the image is uploaded...
Next.js 14.0.1
uploadthing: 6.0.1
What should I do, thanks!
65 Replies
Are you trying to run a built version locally? If so it won’t work because there is no way for the UT infra to send a webhook back to your local machine.
I've tried on vercel and locally as well. Either one is not working.
I had to change uploadthing to google drive because of it. Not really sure whats going on imo its because of new versions of next / uploadthing.
I've used uploadthing in a past and never had this problem...
can you reproduce this? I'm not quite sure I follow what the issue might be if it's not working on vercel either
usually when people report this behavior it's cause they use a built version ( whcih doesn't have our dev webhook) on localhost (which can't be hit by a "normal" webhook) so therefore the callback isn't run - but if it's not working on vercel that's not the case
i've got the same problem as well, using "uploadthing": "^6.0.1" and "next": "^14.0.0"
Do you have a working repro?
downgrading to
"uploadthing": "^5.7.4"
"@uploadthing/react": "^5.7.0",
helped
GitHub
GitHub - teceer/wlotki-online
Contribute to teceer/wlotki-online development by creating an account on GitHub.
open for feedback 🏄♂️
wlotki.online
System biletowy dla wydarzeń
Upload seems to work fine?
Oh I see... it was broken for you in 6.0.1
gonna deploy the not working version
wlotki.online
System biletowy dla wydarzeń
got it
ty.
Current working theory is a race condition where ee.emit() is called before the listener is setup.
we're on it
great! thanks for quick action
Give this a shot?
the same error here
GitHub
GitHub - teceer/wlotki-online at development
Contribute to teceer/wlotki-online development by creating an account on GitHub.
got it, thank you
Im also getting this error on production
Works fine in development
NextJS 13
UT Version 6.0.1
Getting error message in production but still uploads the file to UploadThing server and updates my planetscale values,
Happens when changing my cover photo in Profile Page
Here is repo
https://github.com/AlexisKenAlvarez/gchat
GitHub
GitHub - AlexisKenAlvarez/gchat
Contribute to AlexisKenAlvarez/gchat development by creating an account on GitHub.
Downgrade to
"uploadthing": "^5.7.4"
"@uploadthing/react": "^5.7.0",
for now. We are working on a fix.
OK, new release is out. Should hopefully resolve this issue.
GitHub
Releases · pingdotgg/uploadthing
File uploads for modern web devs. Contribute to pingdotgg/uploadthing development by creating an account on GitHub.
hmm...
recursively getting {"status":"still waiting"} in the response from https://uploadthing.com/api/serverCallback
cc @julius
the file has been transferred
despite the lack of response
I think I may have found the bug
I'll have a canary in a minute or two for you
ok, ready to test
actually that probably wont fix it. Still give it a try though
https://wlotki.vercel.app?_vercel_share=zFXRfEOYWxiRjV0ePlEYkAaGsfgJMhYw
yep, no change on my side
doing a bit more digging
Did you revert to 5.7.4?
"@uploadthing/react": "6.0.2-canary.743cb77",
"uploadthing": "6.0.3-canary.743cb77",
this version is currently on https://wlotki.vercel.app?_vercel_share=zFXRfEOYWxiRjV0ePlEYkAaGsfgJMhYw
didn't change anything since last time
I had a browser tab open in the background, and after some long time some request actually came through, cause i saw the image loaded when closing the tab
Hmm, it seems like your onUploadComplete is failing for some reason, because our infra is never getting the message that lets it know that the callback completed
ok, will check it
Can I have an actual preview build link, since I think these ones are doing something weird with the
?_vercel_share
query param
Our callbacks might go to the wrong placeDoes this work for You? Do You have an access since this is a preview deployment? https://wlotki.vercel.app/
Is that not the prod build?
wlotki.online
System biletowy dla wydarzeń
The link works, but usually I would expect a longer url like
https://<repo>-<branch>-<org name>.vercel.app/
This one seems to work with uploads
https://wlotki.vercel.app is failing like you describe
Ah yeah, this one I would need auth for
strange, the https://wlotki-online-git-development-teceer-s-team.vercel.app/ is failing for mee to, but its connected to the same deployment as https://wlotki.online
wlotki.online
System biletowy dla wydarzeń
wlotki.online
System biletowy dla wydarzeń
Huh... that is very weird.
So the acutal prod deploy on the real domain works correctly. but preview builds are not
first and second domains work, the third one is failing despite all being on the prod
i will build it locally too
Because thst last link is protected so our callback will be rejected
makes sense
I cant visit this
So any request to it would be rejected also
checked it locally, still the same problem
remember for local builds you will need to use ngrok so that the callbacks can get back to your machine
oh, didn't know about that
You'll need to set VERCEL_URL env var to your ngrok tunnel
thanks a lot, i will check on that
and add the url config to the generateComponents and generateReactHelpers
seems to be resolved for me
https://docs.uploadthing.com/api-reference/react#configuration-2
nice!
Glad we were able to get this sorted out
Thankyou! This also resolved mine
If anyone got this far and is still having issues where serverCallback returns '{ status: "still waiting" }' until RetryLimit is hit, then I may have a solution for you.
The cause may be that your FileRouter's 'onUploadComplete' callback is throwing an error. In production I couldn't see any errors thrown in logs. In our staging environment I could.
It would be great if this warning could be added to the Docs, as that would have saved me many hours.
you should get an error log if your callback throws telling you it probably shouldn't? https://github.com/pingdotgg/uploadthing/blob/main/packages/uploadthing/src/internal/handler.ts#L191-L193
GitHub
uploadthing/packages/uploadthing/src/internal/handler.ts at main · ...
File uploads for modern web devs. Contribute to pingdotgg/uploadthing development by creating an account on GitHub.
I did see that error in staging. Could be the case that it was 'omitted' in production due to log overflows. Seems a simple addition to the troubleshooting section.