How to solve this error "You have to define `key` property in options at uploadFileFeature"?
{resource: IFile, options: { navigation: HomePage, properties: { key: { type: 'string', }, // s3Key: { // type: 'string', // }, bucket: { type: 'string', }, mime: { type: 'string', }, comment: { type: 'textarea', isSortable: false, }, }, }, features: [ uploadFeature({ componentLoader, provider: { aws: S3_Credentials }, validation: { mimeTypes: ['image/png'] }, options:{ key: process.env.AWS_ACCESS_KEY_ID, // s3Key: process.env.AWS_ACCESS_KEY_ID, bucket: process.env.AWS_S3_BUCKET, mime: 'image/png', }, }), ], },
I tried to insert an Image in MongoDB using Mongoose with the help of AWS S3, and by the documentation of @adminjs/upload, I got the code. When I got the above error, I replaced "s3Key" with "key" but nothing works..!!
I also tried it with Local File System, but got the same error there as well. features: [ uploadFeature({ provider: localProvider, validation: { mimeTypes: ['image/png', 'application/pdf'], }, options: { key: 323, bucket: './public/files', s3Key: 'uploadFeature', }, }), ],
I use https://docs.adminjs.co/basics/features/upload for reference.
Try to pass properties option into uploadFeature function, like in these examples:
https://github.com/SoftwareBrothers/adminjs-upload/blob/master/example-app/src/admin/resources/photo/photo.resource.ts#L14
features: [uploadFeature({
componentLoader,
provider: { local: { bucket: 'public', opts: {} } },
properties: { file: 'file', key: 's3Key', bucket: 'bucket', mimeType: 'mime' },
validation: { mimeTypes: ['image/png'] },
})],