joschan21 / quill

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

Issue when uploading PDF in dashboard. #83

Open saiksaif opened 5 months ago

saiksaif commented 5 months ago

When I upload a pdf in the dashboard, I start getting a failed POST request which starts repeating infinitely:

POST http://localhost:3000/api/trpc/getFile?batch=1

Screenshot 2024-03-21 at 3 33 47 PM

In the network tab, this is what the request gives:

[ { "error": { "message": "NOT_FOUND", "code": -32004, "data": { "code": "NOT_FOUND", "httpStatus": 404, "stack": "TRPCError: NOT_FOUND\n at eval (webpack-internal:///(rsc)/./src/trpc/index.ts:175:26)\n at async resolveMiddleware (webpack-internal:///(rsc)/./node_modules/@trpc/server/dist/index.mjs:434:30)\n at async callRecursive (webpack-internal:///(rsc)/./node_modules/@trpc/server/dist/index.mjs:464:32)\n at async callRecursive (webpack-internal:///(rsc)/./node_modules/@trpc/server/dist/index.mjs:464:32)\n at async callRecursive (webpack-internal:///(rsc)/./node_modules/@trpc/server/dist/index.mjs:464:32)\n at async resolve (webpack-internal:///(rsc)/./node_modules/@trpc/server/dist/index.mjs:494:24)\n at async inputToProcedureCall (webpack-internal:///(rsc)/./node_modules/@trpc/server/dist/resolveHTTPResponse-2fc435bb.mjs:54:22)\n at async Promise.all (index 0)\n at async resolveHTTPResponse (webpack-internal:///(rsc)/./node_modules/@trpc/server/dist/resolveHTTPResponse-2fc435bb.mjs:190:37)", "path": "getFile" } } } ]

Screenshot 2024-03-21 at 3 34 27 PM

The project is same as it was cloned from the repo, I only added my env variables.

What could be causing this? I checked around for hours and can't figure it out, any help would be really appreciated.

JayGadhethariya456 commented 5 months ago

in uploadthing folder>core.ts have u used const response = await fetch(https://utfs.io/f/${file.key}) this?

saiksaif commented 5 months ago

Do you mean this line:

const response = await fetch(https://uploadthing-prod.s3.us-west-2.amazonaws.com/${file.key})

I am using the project as it is and this line is what's similar the one you mention in the project.

JayGadhethariya456 commented 5 months ago

That's why it's not working try using my line the code is old and uploaded longtime ago

saiksaif commented 5 months ago

I tried but that didn't change anything, still same error.

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.

danishzayan 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.

I have faced same issue and not fixing 😔

danishzayan commented 5 months ago

And when uploading 3 page of pdf still show error that so many page in pdf

Zem-0 commented 3 months ago

did anyone fix it please iam not able to create chat after uploading the pdf it always shows file is too large