We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got Image Tool: uploading failed because of TypeError: Cannot read properties of undefined (reading 'reduce') when im trying to upload an image.
my img:
image: { class: ImageTool, config: { uploader: { uploadByFile: async (file: File) => { console.log(file); // upload to uploadthing const [res] = await uploadFiles([file], 'imageUploader') console.log(res); return { success: 1, file: { url: res[0].fileUrl }, }; }, }, }
my uploadFiles:
import type { OurFileRouter } from '~/app/api/uploadthing/core' import {generateReactHelpers} from "@uploadthing/react"; export const { uploadFiles } = generateReactHelpers<OurFileRouter>();
my router:
import { createUploadthing, type FileRouter } from 'uploadthing/next-legacy' import {currentUser} from "~/lib/auth"; const f = createUploadthing() export const ourFileRouter = { imageUploader: f({ image: { maxFileSize: '4MB' } }) .middleware(async (req) => { console.log(req) const user = await currentUser() if (!user) throw new Error('Unauthorized') return { userId: user.id } }) .onUploadComplete(async ({ metadata, file }) => {console.log(file)}), } satisfies FileRouter export type OurFileRouter = typeof ourFileRouter
Can someone help me
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Got Image Tool: uploading failed because of TypeError: Cannot read properties of undefined (reading 'reduce')
when im trying to upload an image.
my img:
my uploadFiles:
my router:
Can someone help me
The text was updated successfully, but these errors were encountered: