Check for ability to upload file before doing it

Hi all, I'm integrating a limit in my app, in which the free tier allows for X number of files and X number of audio files hours a month. I'm using UploadThing for the file upload and I think it's great, but I want to understand if there's a way to do this kind of checks (maybe at the middleware level) before starting the upload on the UT servers. I know that I can check for this using the onBeforeUploadBegin handle on the uploadthing client library, but I would like to also implement this check on my backend. Thanks in advance, and once I've finished building my app (almost there) I'll be more than happy to become a paid user!
1 Reply
Christian Carpinelli
also, I would add, is there something happening on UT? because after file upload my server fails on this:
16:06:21.923 ERROR handleUploadAction -> handleJsonLineStream Failed to register metadata
{ "error": {"reason":{"_tag":"JsonError","error":{}},"_tag":"HttpBodyError"} }
16:06:21.924 DEBUG handleUploadAction -> handleJsonLineStream Error: {"reason":{"_tag":"JsonError","error":{}},"_tag":"HttpBodyError"} Fiber terminated with an unhandled error
16:06:21.925 DEBUG handleUploadAction Error: {"reason":{"_tag":"JsonError","error":{}},"_tag":"HttpBodyError"} Fiber terminated with an unhandled error
16:06:21.923 ERROR handleUploadAction -> handleJsonLineStream Failed to register metadata
{ "error": {"reason":{"_tag":"JsonError","error":{}},"_tag":"HttpBodyError"} }
16:06:21.924 DEBUG handleUploadAction -> handleJsonLineStream Error: {"reason":{"_tag":"JsonError","error":{}},"_tag":"HttpBodyError"} Fiber terminated with an unhandled error
16:06:21.925 DEBUG handleUploadAction Error: {"reason":{"_tag":"JsonError","error":{}},"_tag":"HttpBodyError"} Fiber terminated with an unhandled error
it never happened before, and I'm trying to understand if it's something on my side (but I didn't touch the code) or UT side having some kind of issues... Thanks!
Want results from more Discord servers?
Add your server