auth function seems like it should work, but the signature taking requests expects a NextApiRequest rather than a NextRequest, and also expects a NextApiResponse as the second argument, which the uploadthing middleware method does not provide AFAIK.