I've encountered an issue that I'm struggling to fix. The only solution I found for resolving errors in this file was the following:
import { clerkMiddleware } from '@clerk/nextjs/server';
import { NextResponse } from 'next/server';
export default clerkMiddleware(
(auth, req) => {
try {
// Code logic here...
} catch (error) {
console.error('Error in authMiddleware:', error.message);
// Handle error response
return NextResponse.error();
}
}
);
export const config = {
matcher: ['/((?!.+\\.[\\w]+$|_next).*)', '/', '/(api|trpc)(.*)'],
};
However, when attempting to upload a file using UploadThing Dropbox, I encountered the following errors:
ℹ UPLOADTHING 9:06:21 AM UploadThing dev server is now running!
⨯ UPLOADTHING 9:06:21 AM [
⨯ UPLOADTHING 9:06:21 AM "An error occured in your middleware function",
⨯ UPLOADTHING 9:06:21 AM {
⨯ UPLOADTHING 9:06:21 AM "message": "Failed to run middleware",
⨯ UPLOADTHING 9:06:21 AM "_tag": "UploadThingError",
⨯ UPLOADTHING 9:06:21 AM "name": "UploadThingError",
⨯ UPLOADTHING 9:06:21 AM "code": "INTERNAL_SERVER_ERROR",
⨯ UPLOADTHING 9:06:21 AM "cause": {}
⨯ UPLOADTHING 9:06:21 AM }
⨯ UPLOADTHING 9:06:21 AM ]
⨯ UPLOADTHING 9:06:21 AM Failed to run middleware
Any suggestions on how to tackle this? I've tried the latest version of @clerk/nextjs and clerkMiddleware without success.
Feeling like I've exhausted all options, any assistance would be greatly appreciated. Thank you in advance!