You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement something like custom validation in my new action (when creating new record). So, at least I want my upload image field to be required. And in future - maybe I'll add some other logic related to this image... So, I need this stuff in my action. I tried to retrieve this uploaded image from request's payload, but I simply haven't got this field.
My schema look like:
model Product {
id Int @id @default(autoincrement())
title String
coverImageUrl String
coverImageMimeType String
...other fields
}
I wrote my custom MinioProvider, but it doesn't matter. So, this setup give me properly renrered UI, I can uplaod file, I can save all data to db and I can save my image to minio storage. But, as I discovered later, it doesn't provide me my currently uploaded file in the request.payload. Btw, I inspected the request, that was made by adminjs, and my file was successfully included to it under "image.0" property, but this property does not appear in payload.
And, I played a little with this stuff, and discovered next BUG. If I change file: 'image', to any random value like file: 'test',, this action automaticly restarts my backend server, but not restart the frontend. So, changes applies on backend, frontend stays the same. and if I send the same request again (with all the data in form, like it was before this change) then I surprisingly CAN ACCESS to my file via 'image.0' property in payload. So, it is possible in this specific case, in case of this bug. But, when I update the frontend page, and try to create my product again, than problems returns. So, client sends file under new "test.0" property in formData, and I really cant access it.
Maybe someone has any ideas how it is? or maybe I doing something wrong? Is it possible to actually retrieve file data in request paylaod?
Contact Details
No response
What happened?
I'm trying to implement something like custom validation in my new action (when creating new record). So, at least I want my upload image field to be required. And in future - maybe I'll add some other logic related to this image... So, I need this stuff in my action. I tried to retrieve this uploaded image from request's payload, but I simply haven't got this field.
My schema look like:
My upload feature setup is:
I wrote my custom MinioProvider, but it doesn't matter. So, this setup give me properly renrered UI, I can uplaod file, I can save all data to db and I can save my image to minio storage. But, as I discovered later, it doesn't provide me my currently uploaded file in the request.payload. Btw, I inspected the request, that was made by adminjs, and my file was successfully included to it under "image.0" property, but this property does not appear in payload.
And, I played a little with this stuff, and discovered next BUG. If I change
file: 'image',
to any random value likefile: 'test',
, this action automaticly restarts my backend server, but not restart the frontend. So, changes applies on backend, frontend stays the same. and if I send the same request again (with all the data in form, like it was before this change) then I surprisingly CAN ACCESS to my file via 'image.0' property in payload. So, it is possible in this specific case, in case of this bug. But, when I update the frontend page, and try to create my product again, than problems returns. So, client sends file under new "test.0" property in formData, and I really cant access it.Maybe someone has any ideas how it is? or maybe I doing something wrong? Is it possible to actually retrieve file data in request paylaod?
Bug prevalence
every time
AdminJS dependencies version
@adminjs/express": "^6.1.0",
"@adminjs/prisma": "^5.0.2",
"@adminjs/upload": "^4.0.2",
"adminjs": "^7.8.12",
What browsers do you see the problem on?
No response
Relevant log output
No response
Relevant code that's giving you issues
No response
The text was updated successfully, but these errors were encountered: