-
-
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:strapiSource is core/strapi packageSource is core/strapi packagestalestale-before-2022status: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members
Description
Bug report
Describe the bug
I am trying to add a new item to a repeatable component field through an API PUT /api/[api-name]/:id. I expected to be able to push a new item on the array without an ID and it will be created, but I receive an error instead. I am not sure if this is a bug or my misunderstanding of the API.
Steps to reproduce the behavior
- Inside my
beforeUpdate()lifecycle hook for myListsAPI, - I try to add a new item to my existing
itemsarray by using:
event.params.data.items.push({
title: "Washcloths",
checked: true
})
- I can see it is properly added to the data
// event.params.data
{
title: 'Craigslist',
items: [ { title: 'Washcloths', checked: true } ],
updatedAt: 2021-12-22T00:21:36.488Z
}
- Then I get the error
error: Invalid id, expected a string or integer, got [object Object]once it is run
Error: Invalid id, expected a string or integer, got [object Object]
at node_modules/@strapi/database/lib/entity-manager.js:25:15
Expected behavior
I would expect it to create a new item for me.
System
- Node.js version: v16.13.0
- NPM version: 8.1.0
- Strapi version: 4.0.0
- Database: sqlite3
- Operating system: Mac OS Monterrey
LouisLec, igolskyi, Canice-James, v4dkou, finfa and 5 moreigolskyi and Canice-James
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:strapiSource is core/strapi packageSource is core/strapi packagestalestale-before-2022status: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members
Type
Projects
Status
Fixed/Shipped
