UploadThingError at INTERNAL_DO_NOT_USE__fatalClientError
I get this errors on uplaoding
- GET https://api.uploadthing.com/v6/serverCallback net::ERR_BLOCKED_BY_CLIENT
- Something went wrong. Please contact UploadThing and provide the following cause: FetchError
- UploadThingError at INTERNAL_DO_NOT_USE__fatalClientError (index.js:352:1)
at eval (button-client-D2-JDNio.js:196:66)Caused by: FetchError
at Object.catch (index.js:380:1)
at eval (Micro.js:731:1)
-----------------------------
this is my core.ts
import { useUserServer } from "@/app/_lib/user";
import { createUploadthing, type FileRouter } from "uploadthing/next";
import { UploadThingError } from "uploadthing/server";
const f = createUploadthing();
// FileRouter for your app, can contain multiple FileRoutes
export const ourFileRouter = {
// Define as many FileRoutes as you like, each with a unique routeSlug
imageUploader: f({ image: { maxFileSize: "8MB" } })
// Set permissions and file types for this FileRoute
.middleware(async () => {
const user = await useUserServer();
if (!user) throw new UploadThingError("Unauthorized");
return { userId: user?.id };
})
.onUploadComplete(async ({ metadata, file }) => {
// This code RUNS ON YOUR SERVER after upload
// console.log("Upload complete for userId:", metadata.userId);
// console.log("file url", file.url);
// !!! Whatever is returned here is sent to the clientside
onClientUploadComplete callback
return { uploadedBy: metadata.userId };
}),
} satisfies FileRouter;
export type OurFileRouter = typeof ourFileRouter;
I am using Next auth (auth js) and in the middleware I allowed "/api/uploadthing" route.
note: also first time to upload always work fine.
is there anything I missing please help?0 Replies