UploadThing + Next.js (App Router) + Kinde Auth middleware ā Failed to parse response (InvalidJson)
Hi everyone š, Iām using Next.js (App Router) with TypeScript, Prisma, and Kinde Auth middleware, and I keep hitting this error when trying to upload an image with UploadThing:
UploadThingError: Failed to parse response from UploadThing server
Caused by: InvalidJson
My setup:
middleware.ts uses withAuth from @kinde-oss/kinde-auth-nextjs.
I already excluded /api/uploadthing in both publicPaths and matcher.
My next.config.ts has utfs.io under images.domains.
In app/api/uploadthing/route.ts, Iām using createNextRouteHandler with runtime = "nodejs".
But the UploadThing server still fails with the same error.
4 Replies
only thing i can think of here is that you're getting a 404/401 next.js page with html content that fails to json parse
let me explain my issue
i am using nextjs with ts also uploadthing to upload image once i upload image it show error like images below how can i fix it?


currently i have upgraded latest version of uploadthing so error was gone thanks a lot @julius