I successfully updated the component using the PUT
command, and after that Strapi threw the error:
Error: The target polymorphic type "components_COMPONENT_NAME" is not one of the defined target types
The command I used to update the Strapi component:
PUT http://localhost:1337/content-type-builder/components/COMPONENT_DIR.COMPONENT_NAME
{
"components": [],
"component": {
"category": "COMPONENT_DIR",
"icon": "biohazard",
"name": "COMPONENT_NAME",
"description": "",
"connection": "default",
"collectionName": "components_COMPONENT_DIR_COMPONENT_NAME",
"attributes": {
"type": {
"type": "string",
"default": ""
},
"uuid": {
"type": "string"
},
"title": {
"type": "text"
},
"description": {
"type": "text"
},
"banner_image": {
"type": "media",
"multiple": false
}
}
}
}
It's not exactly the same issue, but I also got this error because of the media-library. I created a collection type which used certain images from the media library, afterwards I deleted this collection, which resulted in an error for all related images because the collection wasn't accessible anymore and Strapi threw this error.
I had to recreate the collection type with the same name, then delete all related images, delete the collection and then upload the images again...
It seems like this is an error with the media library-plugin, which should delete these relations if you delete some content of specific components or collections.
This error appeared for me, when I renamed a collection type and everything that comes with it (display name, collection name, routes, config, controllers, config, services).
After I did that, the data was not displayed anymore in the Strapi
admin dashboard. As I then tried to re-uploaded some of the media I got that error:
Error: The target polymorphic type "old_collection_type_name" is not one of the defined target types
The media still was inside the folder my_root_project/public/uploads
, it just didn't show up in dashboard. After I deleted the uploads
folders content, the error was gone.
I hope this info helps somebody.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With