joschan21 / quill

Quill - A Modern SaaS-Platform Built With Next.js 13
1.86k stars 490 forks source link

File gets uploaded locally but when trying on deployed version it gets stuck on redirecting #33

Open rishav887 opened 10 months ago

rishav887 commented 10 months ago

File gets uploaded locally but when trying on deployed version it gets stuck on redirecting

on the network tab i see - i have deployed it on railway.app

[ { "error": { "message": "NOT_FOUND", "code": -32004, "data": { "code": "NOT_FOUND", "httpStatus": 404, "path": "getFile" } } } ]

willbrandin commented 10 months ago

I have this issue too. I'm not seeing the new file added in the database either. I wonder if there's an issue in the onUploadComplete function in src/app/api/uploadthing/core.ts

engmsaleh commented 10 months ago

I have the same issue, Any updates or solutions?

rishav887 commented 10 months ago

Versel works fine for me

engmsaleh commented 10 months ago

@willbrandin Yes, I have encountered the same issue, for some reason, it seems that onUploadComplete is not being fired in a production environment

husmaret commented 9 months ago

Could be an authentication issue, as I also get a 401 error just before the 404. Meaning the middeware before onUploadComplete might return an Unauthorized. But I also have not found a solution yet.

Edit: Ok, so apparently not an Authentication issue. In 'Dev' mode, uploadthing simulates a webhook, to notify the server, when the fileupload is finished. This is not done in 'production' environment. Still do not know how to solve it, but there is an issue on the uploadthing github: https://github.com/pingdotgg/uploadthing/issues/474

m3phist commented 8 months ago

I finally got the file upload running on production by installing the new version of uploadthing@6.1.0 and @uploadthing/react@6.0.2. Make sure to push and test directly on Vercel, not in the local npm build. Anyway, Uploadthing warns not to test callbacks on localhost. That is how I finally got it to work.

[UT] [WARN] You are using a localhost callback url in production which is not supported. Read more and learn how to fix it here: https://uploadthing.com/faq#my-callback-runs-in-development-but-not-in-production

alvinpeter9 commented 8 months ago

The uploadthing documentation has not been updated to reflect the new update. @m3phist can you show us where or what you changed in your code?

gptsparky commented 5 months ago

I had the same issue, file uploading didn't work when deployed. It was stuck at the upload box loading. Looking at the logs, the api/trpc/getFile endpoint was being polled every few seconds and never stopped (also error 404).

Afterward, I noticed the file was successfully uploaded to UploadThing but it was NOT added to the database (thus the infinite polling), so the issue was the code to add the file to the database wasn't running (the code in the callback onUploadComplete in src/app/api/uploadthing/core.ts).

Turns out Vercel was the issue, it allowed a maximum of a few seconds of computing at a time so the uploaded file was never added to the database as the code to do it timed out. Thus, the infinite polling.

TLDR; the solution is to deploy elsewhere like Netlify or upgrade from the Hobby plan on Vercel.

seancaleb commented 5 months ago

@gptsparky I'm having the same issue as you when I deployed my express app on railway. I am hosting my client in Vercel and currently using Preview Deployments. I've already did what UploadThing docs say about turning off Vercel Authentication Vercel preview deployments, unfortunately, it still didn't work for me.

It uploads the file to UploadThing but the onUploadComplete callback doesn't trigger which causes the loading on my client to not stop.

Upon viewing the logs from railway I saw this kind of error.

image

Selvagokul commented 2 months ago

Screenshot (413) in live file is not uploaded give me any solution