Theo's Typesafe CultTTC
Theo's Typesafe Cult•5mo ago•
5 replies
Khader A_

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.
Was this page helpful?