Getting the Unknown arg error - even though I'm pa...
# orm-help
c
Getting the Unknown arg error - even though I'm passing an int as requested. Do my fields need unique identifiers? Error:
Copy code
Unknown arg `id` in data.id for type MainSidebarUpdateInput. Available args: 
                                                                             
type MainSidebarUpdateInput {                                                
  Main_Sidebar?: String | NullableStringFieldUpdateOperationsInput | Null    
}                                                                            
                                                                             
 +34621ms                                                                    
Error:                                                                       
Invalid `prisma.mainSidebar.update()` invocation:                            
                                                                             
{                                                                            
  where: { ID: 1 }
service:
Copy code
async updateMainSidebar(params: {
    where: Prisma.MainSidebarWhereUniqueInput;
    data: Prisma.MainSidebarUpdateInput;
  }) {
    const { where, data } = params;
    return this.prisma.mainSidebar.update({
      where,
      data
    });
  }
controller:
Copy code
@Put(`${Route}/:id`)
  async update(
    @Param('id', ParseIntPipe) ID: number,
    @Body() data: Prisma.MainSidebarUpdateInput
  ) {
    return this.mainSidebarService.updateMainSidebar({
      where: { ID },
      data,
    });
  }
schema
Copy code
model MainSidebar {
  ID           Int     @id @default(autoincrement())
  Main_Sidebar String? @db.VarChar(Max)
}
Application side error:
Copy code
HttpErrorResponse: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":500,"statusText":"Internal Server Error","url":"<http://am-web11:3060/api/sidebar/1>","ok":false,"name":"HttpErrorResponse","message":"Http failure response for <http://am-web11:3060/api/sidebar/1>: 500 Internal Server Error","error":{"statusCode":500,"message":"Internal server error"}}
a
Hey @Chip Clark! Prisma doesn't allow you to update an
@id
field (primary key) like
ID
in your case. If you look at
MainSidebarUpdateInput
, you will see that
ID
is not present on that type for this reason.
c
THANK YOU - yes, that was it. Took id out of the JSON body and it works.