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
Uploading simple local file gives: "no such file or directory, mkdir 'C:\\...\\api-fastify\\public\\files\\id()" ... "Resource: \"${this.resource.id()}\" does not have an id property"
#83
Open
rw3iss opened this issue
Jul 14, 2024
· 0 comments
I'm trying to setup AdminJS on a simple fastify backend, using typeorm and postges. I have been having issues getting a file upload to work, suggesting there is no id property set on the resource.
Following the example app for a single file, the upload form seems to work, but when I save it the backend gives the error:
{
"statusCode": 500,
"code": "ENOENT",
"error": "Internal Server Error",
"message": "ENOENT: no such file or directory, mkdir 'C:\\Users\\rw3iss\\Sites\\api-fastify\\public\\files\\id() {\n
const idProperty = this.resource.properties().find(p => p.isId());\n
if (!idProperty) {\n
throw new Error(`Resource: \"${this.resource.id()}\" does not have an id property`);\n
}\n
return this.params[idProperty.name()];\n }'"
}
Here's a screenshot of the upload page after saving:
In trying to debug I notice the adminjs library tries to assign the properties, but it seems the id property never has _isId: true, I only ever see it false for any property, even after the property decoration is finished and merged:
Any ideas? I don't know if this an issue in the typeorm adapter or the adminjs BaseAdapter not loading those properties as expected, or maybe my config is wrong. I have been trying to dig further into the adminjs and upload feature code to see why. Still working it out...
The text was updated successfully, but these errors were encountered:
rw3iss
changed the title
Uploading simple local file gives: "no such file or directory, mkdir 'C:\\Users\\rw3iss\\Sites\\api-fastify\\public\\files\\id()" ... "Resource: \"${this.resource.id()}\" does not have an id property"
Uploading simple local file gives: "no such file or directory, mkdir 'C:\\...\\api-fastify\\public\\files\\id()" ... "Resource: \"${this.resource.id()}\" does not have an id property"
Jul 14, 2024
I'm trying to setup AdminJS on a simple fastify backend, using typeorm and postges. I have been having issues getting a file upload to work, suggesting there is no id property set on the resource.
Following the example app for a single file, the upload form seems to work, but when I save it the backend gives the error:
relevant package.json dependency versions are:
The typeorm File entity is defined as:
The AdminJS File resource:
The AdminJS config/initialization is:
Here's a screenshot of the upload page after saving:
In trying to debug I notice the adminjs library tries to assign the properties, but it seems the id property never has
_isId: true
, I only ever see it false for any property, even after the property decoration is finished and merged:I've tried to add the isId: true property to the File resource id property, but it still never shows _isId: true anywhere.
Any ideas? I don't know if this an issue in the typeorm adapter or the adminjs BaseAdapter not loading those properties as expected, or maybe my config is wrong. I have been trying to dig further into the adminjs and upload feature code to see why. Still working it out...
The text was updated successfully, but these errors were encountered: