Skip to content
New issue

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

Error: You cannot upload file for not persisted record. Save record first. #26

Open
Saurabhkmr98 opened this issue Jun 9, 2021 · 1 comment

Comments

@Saurabhkmr98
Copy link

@Amixengineer I am facing similar issue while uploading file to s3..
These are the code snippets for options, package.json and schema.

const teacherParams = {
resource: Teacher,
options: {
listProperties: ["name", "email", "phone", "status"],
},
features: [
uploadFeature({
provider: {
aws: {
region: env.region,
bucket: env.bucket,
secretAccessKey: env.secretAccessKey,
accessKeyId: env.accessKeyId,
expires: 0,
},
},
properties: {
key: "fileUrl",
mimeType: "mimeType",
},
validation: {
mimeTypes: ["image/png", "image/jpg", "image/jpeg"],
},
multiple: true,
}),
],
};

"dependencies": {
"@admin-bro/upload": "^1.3.1",
"admin-bro": "^4.0.1",
"admin-bro-expressjs": "^2.1.1",
"admin-bro-mongoose": "^0.5.2",

const teacherSchema = new Schema({
name: String,
email: String,
about: String,
countryCode: Object,
phone: String,
createdAt: Date,
password: String,
status: Number,
permissionLevel: Number,
updatedAt: Date,
// updatedBy: Schema.Types.ObjectId,
timeZone: String,
fileUrl: [
{
type: String,
},
],
mimeType: [
{
type: String,
},
],
imageURL: String,
});

Any idea how to fix this @wojtek-krysiak @Amixengineer

Originally posted by @Saurabhkmr98 in #14 (comment)

@deathlock
Copy link

hey @Saurabhkmr98 ,

Did you find any solution? I am facing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants