UploadThing in a backend application
I'm trying to use uploadthing in my Discord Bot, since I don't have any routing or anything complex, I thought that using
UTAPI SDK
would be enough, but I'm facing a weird error.
Whenever I try to use any method provided by UTApi errors with (FiberFailure) TypeError: Attempted to assign to readonly property.
Full Error:
uploadthing: ^6.10.1
bun: 1.1.3
13 Replies
I tried using the API but I couldn't understand how to use it.
This is a bug in bun https://github.com/oven-sh/bun/issues/10178
GitHub
class extending blob cant set
name
prop · Issue #10178 · oven-sh/...What version of Bun is running? 1.1.2+c8d072c2a What platform is your computer? Darwin 23.2.0 arm64 arm What steps can reproduce the bug? Repo: https://github.com/juliusmarminge/bun-blob To test, r...
So what should I do then? Wait for a fix or use some other workaround? I see you commented saying that using
Buffer
works fine, but I'm not sure if I should that or not.
Btw, I'm okay with using the API but couldn't understand how to use it, is there any content or project example you could recommend? Thanks! :a_shyemoji:Im afraid waiting for a fix might be the way unfortunately…. That’s kinda life when bleeding on the edge with new stuff. I’ve had to go back to pnpm from bun on a numerous of projects due to weird behaviors and missing features
But you should be able to use the native File class unless you need customId prop from UTFile
That's exactly what I did initially, I moved from Bun to PNPM back again, because of some gRPC issues, but realized things are getting better and went back to Bun, now facing another issue :Sad:
Yup ://
Been there, done that
It's a very very very completely idiot solution, but I just removed those lines and gave it a try. It worked but I lost the capability to send these informations, so my files are named in a way I don't want to. I really don't want to use any other service, really like UploadThing.
Do you use customId field? If not just send File’s. Or are you uploading from URLs?
From urls.
Could patch and change UTFile to File - although patching in Bun sucks too
This here is exactly what Im doing
You should be able to patch and change this line to be just a File and remove the customId (assuming you dont use that) https://github.com/pingdotgg/uploadthing/blob/c4ba73691f514e9a4e2da0e0326ce738395e9a2c/packages/uploadthing/src/sdk/utils.ts#L125
GitHub
uploadthing/packages/uploadthing/src/sdk/utils.ts at c4ba73691f514e...
File uploads for modern web devs. Contribute to pingdotgg/uploadthing development by creating an account on GitHub.
Im gonna take a look in a second! Thank you so much.