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
markr
markr13mo ago
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.
DanielHigh
DanielHighOP13mo ago
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...
julius
julius13mo ago
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
ketyov
ketyov13mo ago
i've got the same problem as well, using "uploadthing": "^6.0.1" and "next": "^14.0.0"
markr
markr13mo ago
Do you have a working repro?
ketyov
ketyov13mo ago
downgrading to "uploadthing": "^5.7.4" "@uploadthing/react": "^5.7.0", helped
ketyov
ketyov13mo ago
GitHub
GitHub - teceer/wlotki-online
Contribute to teceer/wlotki-online development by creating an account on GitHub.
ketyov
ketyov13mo ago
open for feedback 🏄‍♂️
ketyov
ketyov13mo ago
wlotki.online
System biletowy dla wydarzeń
markr
markr13mo ago
Upload seems to work fine?
No description
markr
markr13mo ago
Oh I see... it was broken for you in 6.0.1
ketyov
ketyov13mo ago
gonna deploy the not working version
ketyov
ketyov13mo ago
rollbacked, You can check https://wlotki.online now
wlotki.online
System biletowy dla wydarzeń
markr
markr13mo ago
got it ty. Current working theory is a race condition where ee.emit() is called before the listener is setup. we're on it
ketyov
ketyov13mo ago
great! thanks for quick action
markr
markr13mo ago
@uploadthing/[email protected]
@uploadthing/[email protected]
Give this a shot?
ketyov
ketyov13mo ago
the same error here
ketyov
ketyov13mo ago
GitHub
GitHub - teceer/wlotki-online at development
Contribute to teceer/wlotki-online development by creating an account on GitHub.
ketyov
ketyov13mo ago
No description
markr
markr13mo ago
got it, thank you
AKI
AKI13mo ago
Im also getting this error on production
AKI
AKI13mo ago
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,
No description
AKI
AKI13mo ago
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.
markr
markr13mo ago
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.
markr
markr13mo ago
GitHub
Releases · pingdotgg/uploadthing
File uploads for modern web devs. Contribute to pingdotgg/uploadthing development by creating an account on GitHub.
markr
markr13mo ago
hmm...
ketyov
ketyov13mo ago
recursively getting {"status":"still waiting"} in the response from https://uploadthing.com/api/serverCallback
markr
markr13mo ago
cc @julius
ketyov
ketyov13mo ago
the file has been transferred despite the lack of response
markr
markr13mo ago
I think I may have found the bug I'll have a canary in a minute or two for you
ketyov
ketyov13mo ago
ok, ready to test
markr
markr13mo ago
"@uploadthing/react": "6.0.2-canary.743cb77",
"uploadthing": "6.0.3-canary.743cb77"
"@uploadthing/react": "6.0.2-canary.743cb77",
"uploadthing": "6.0.3-canary.743cb77"
actually that probably wont fix it. Still give it a try though
markr
markr13mo ago
doing a bit more digging Did you revert to 5.7.4?
ketyov
ketyov13mo ago
"@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
markr
markr13mo ago
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
ketyov
ketyov13mo ago
ok, will check it
markr
markr13mo ago
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 place
ketyov
ketyov13mo ago
Does this work for You? Do You have an access since this is a preview deployment? https://wlotki.vercel.app/
markr
markr13mo ago
Is that not the prod build?
ketyov
ketyov13mo ago
actually pushed to production on https://wlotki.online too
wlotki.online
System biletowy dla wydarzeń
markr
markr13mo ago
The link works, but usually I would expect a longer url like https://<repo>-<branch>-<org name>.vercel.app/
markr
markr13mo ago
No description
markr
markr13mo ago
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
ketyov
ketyov13mo ago
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ń
ketyov
ketyov13mo ago
No description
markr
markr13mo ago
Huh... that is very weird. So the acutal prod deploy on the real domain works correctly. but preview builds are not
ketyov
ketyov13mo ago
first and second domains work, the third one is failing despite all being on the prod i will build it locally too
julius
julius13mo ago
Because thst last link is protected so our callback will be rejected
ketyov
ketyov13mo ago
makes sense
julius
julius13mo ago
I cant visit this So any request to it would be rejected also
ketyov
ketyov13mo ago
checked it locally, still the same problem
markr
markr13mo ago
remember for local builds you will need to use ngrok so that the callbacks can get back to your machine
ketyov
ketyov13mo ago
oh, didn't know about that
markr
markr13mo ago
You'll need to set VERCEL_URL env var to your ngrok tunnel
ketyov
ketyov13mo ago
thanks a lot, i will check on that
markr
markr13mo ago
and add the url config to the generateComponents and generateReactHelpers
ketyov
ketyov13mo ago
seems to be resolved for me
markr
markr13mo ago
https://docs.uploadthing.com/api-reference/react#configuration-2 nice! Glad we were able to get this sorted out
AKI
AKI13mo ago
Thankyou! This also resolved mine
Slammer
Slammer5mo ago
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.
julius
julius5mo ago
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.
Slammer
Slammer5mo ago
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.
Want results from more Discord servers?
Add your server