-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundIf it breaks the basic use of the product but can be worked aroundsource: core:databaseSource is core/database packageSource is core/database packagestatus: pending reproductionWaiting for free time to reproduce the issue, or more informationWaiting for free time to reproduce the issue, or more information
Description
Bug report
Describe the bug
I have created a Collection in which I have a field Slug of type UID.
At present, if I try to add data having the same UID in the Collection using API, it throws Internal Server Error but doesn’t even mention the error about UID.
{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal server error occurred"
}
Whereas when the same insertion is tried from the Admin, I get to see the Unavailable result.

Steps to reproduce the behavior
- Go to Content-Types builder
- Add a new Collection of your Choice
- Add a new field of type UID
- Once done, try adding a new value to the Collection.
- Again try to add the same value and it will show you Unavailable error in the Admin
- Try to use the API call and see if you can insert the same values
- You will get the above-mentioned error
Expected behavior
Expected to get the API response as it's sent in the Admin:
{
"statusCode":400,
"error":"Bad Request",
"message":"Invalid input data. Please verify unique constraints"
}
Code snippets
{
"kind": "collectionType",
"collectionName": "user_lists",
"info": {
"name": "UserList",
"description": ""
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": false
},
"attributes": {
"Name": {
"type": "string"
},
"IsPrivate": {
"type": "boolean",
"default": false
},
"Description": {
"type": "string"
},
"Slug": {
"type": "uid"
},
"Items": {
"via": "List",
"collection": "user-list-item"
},
"User": {
"via": "Lists",
"model": "user"
}
}
}
System
- Node.js version: 14.15.1
- Strapi version: 3.4.3
- Database: PostgreSQL
- Operating system: Ubuntu 20.04
Additional context
I tried reproducing the same in Local and I can see the same error in my Local Environment
- Node.js version: 14.15.1
- NPM version: 6.14.8
- Strapi version: 3.4.3
- Database: PostgreSQL
- Operating system: Windows 10 20H2
Checked the PostgreSQL logs and can see the same error:
ERROR: duplicate key value violates unique constraint "user_lists_slug_unique"
DETAIL: Key ("Slug")=(first-list) already exists.
dgtllion, linkeal and Zitrone4422phuber and gvocale
Metadata
Metadata
Assignees
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundIf it breaks the basic use of the product but can be worked aroundsource: core:databaseSource is core/database packageSource is core/database packagestatus: pending reproductionWaiting for free time to reproduce the issue, or more informationWaiting for free time to reproduce the issue, or more information