Skip to content

How to solve this error "You have to define key property in options at uploadFileFeature"? #67

@yyash145

Description

@yyash145

{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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions