System Information
- Strapi Version: 4.5.3
- Operating System: Mac OS 12.6
- Database: mysql
- Node Version: 16
- NPM Version: 6
- Yarn Version: 1.22.19
I am having an issue that is only seemingly occurring on the live production website (it does not occur on a staging website or locally) when attempting to update a relation field, I get the following error during the PUT request
{
"data": null,
"error": {
"status": 500,
"name": "InternalServerError",
"message": "Internal Server Error"
}
}
This issue has just occurred recently and I’m not actually sure where to look to resolve this issue?
This is the schema of the content type article
which holds the related field with the issue category
{
"kind": "collectionType",
"collectionName": "articles",
"info": {
"singularName": "article",
"pluralName": "articles",
"displayName": "Articles",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"Title": {
"type": "string",
"required": true,
"minLength": 1
},
"Slug": {
"type": "uid",
"targetField": "Title",
"required": true
},
"SEO": {
"type": "component",
"repeatable": false,
"component": "seo.seo",
"required": true
},
"Excerpt": {
"type": "text",
"maxLength": 240
},
"categories": {
"type": "relation",
"relation": "oneToMany",
"target": "api::category.category"
},
"Content": {
"type": "richtext",
"required": true
},
"Poster": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": ["images", "files", "videos", "audios"]
},
"Gallery": {
"type": "media",
"multiple": true,
"required": false,
"allowedTypes": ["images", "files", "videos", "audios"]
}
}
}
and this is the category schema
{
"kind": "collectionType",
"collectionName": "categories",
"info": {
"singularName": "category",
"pluralName": "categories",
"displayName": "Category",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"Name": {
"type": "string"
}
}
}
in the PUT
request this is the categories
property and it’s value in the body of the request
{
"disconnect": [],
"connect": [
{
"id": 1
}
]
}
The initial creation of the content type article
is fine, you can select the categories, it’s only once you attempt to update the categories
does the error arise.
This is the body on the POST
for creating an article
{
"SEO": {
"PageTitle": ""
},
"categories": {
"disconnect": [],
"connect": [
{
"id": 3
}
]
},
"Slug": "article-1",
"Content": ""
}
Then when attempting to immediately update the article by adding a new category, this is the PUT
body
{
"id": 40,
"Title": null,
"Content": "",
"createdAt": "2023-07-03T09:47:41.052Z",
"updatedAt": "2023-07-03T09:47:41.052Z",
"publishedAt": null,
"Slug": "article-1",
"Excerpt": null,
"SEO": {
"id": 30,
"PageTitle": "",
"MetaDescription": null
},
"categories": {
"disconnect": [],
"connect": [
{
"id": 2
}
]
},
"Poster": null,
"Gallery": null,
"createdBy": 1,
"updatedBy": 1
}
Which returns the 500 error.
I’ve checked the ADMINISTRATION PANEL Roles & USERS & PERMISSIONS PLUGIN Roles on both the dev site where there is no issue and the live site and they seem to match up.
If there are any further details you need to know, do not hesitate to ask.
Any help would be greatly appreciated.