Skip to content

LB4 todo-list example gives Error: Property "todoListId" cannot be changed! #2658

@foobarrrz

Description

@foobarrrz

I have cloned the project using cli "lb4 example todo-list" without modifying anything.

After I Inserted new record to "todo-list" model, I got the response.
{ "id": 3, "title": "newToDoList", "color": "red" }

then I use id = 3 as an input for POST /todo-lists/{id}/todos.

Unhandled error in POST /todo-lists/3/todos: 500 Error: Property "todoListId" cannot be changed!
    at Object.constrainDataObject (D:\Projects\NodeJs\lbex\loopback4-example-todo-list\node_modules\@loopback\repository\dist\repositor
ies\constraint-utils.js:49:19)
    at DefaultHasManyRepository.create (D:\Projects\NodeJs\lbex\loopback4-example-todo-list\node_modules\@loopback\repository\dist\rela
tions\has-many\has-many.repository.js:21:59)
    at process._tickCallback (internal/process/next_tick.js:68:7)

I also try to create the relation model myself following the example.
https://loopback.io/doc/en/lb4/HasMany-relation.html
But it also give the same error.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions