onUploadComplete and onUploadErorr callback not working

its a react + node project
export const uploadRouter = {
imageUploader: f(
{
image: {
maxFileSize: "4MB",
maxFileCount: 1,
},
},
{
awaitServerData: true,
}
)
.onUploadError(({ error, fileKey }) => {
console.log("upload error", { message: error.message, fileKey });
throw error;
})
.onUploadComplete(async ({ metadata, file }) => {
console.log("Upload complete for userId:", file);
console.log("file url", file.url);

return { uploadedBy: "1234" };
}),
} satisfies FileRouter;
export const uploadRouter = {
imageUploader: f(
{
image: {
maxFileSize: "4MB",
maxFileCount: 1,
},
},
{
awaitServerData: true,
}
)
.onUploadError(({ error, fileKey }) => {
console.log("upload error", { message: error.message, fileKey });
throw error;
})
.onUploadComplete(async ({ metadata, file }) => {
console.log("Upload complete for userId:", file);
console.log("file url", file.url);

return { uploadedBy: "1234" };
}),
} satisfies FileRouter;
even though the upload is successfull, i dont see any logs from onUploadComplete nor onUploadError . just this

{"message":"Sending presigned URLs to client","logLevel":"INFO","timestamp":"2025-01-21T11:33:35.521Z","annotations":{"presignedUrls":[{"url":"https://sea1.ingest.uploadthing.co

{"message":"Sending presigned URLs to client","logLevel":"INFO","timestamp":"2025-01-21T11:33:35.521Z","annotations":{"presignedUrls":[{"url":"https://sea1.ingest.uploadthing.co
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?