SyntaxError for UploadThing

using any UploadThing component breaks my code, because of this error
- error SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)


I dont seem to know where I'm messing up,
"use client";
// You need to import our styles for the button to look right. Best to import in the root /layout.tsx but this is fine
import "@uploadthing/react/styles.css";

import { UploadButton } from "@uploadthing/react";

import { OurFileRouter } from "@/app/api/uploadthing/core";

export default function Upload() {
    return (
        <div>
            <UploadButton<OurFileRouter>
                endpoint="imageUploader"
                onClientUploadComplete={(res) => {
                    // Do something with the response
                    console.log("Files: ", res);
                    alert("Upload Completed");
                }}
                onUploadError={(error: Error) => {
                    // Do something with the error.
                    alert(`ERROR! ${error.message}`);
                }}
            />

        </div>
    );
}
Was this page helpful?