Help! I’m stuck with a weird error in Notion’s JavaScript SDK.
I’m trying to update some pages in my Notion database, but I keep getting this validation error:
Client warn: request fail {
code: 'validation_error',
message: 'body failed validation. Fix one: body.properties.body.id should be defined, instead was undefined.
body.properties.body.name should be defined, instead was undefined. body.properties.body.start should be defined, instead was undefined.'
}
I’ve been scratching my head over this for hours. Here’s a simplified version of what I’m trying to do:
hey, ive had a similar hiccup. try logging page.properties to spot the correct prop. once you see a rich_text prop, update using that key. hope it fixes it, good luck!
I’ve encountered this issue before, and it’s often related to how the Notion API handles property updates. The error suggests you’re trying to update a ‘body’ property that doesn’t exist or isn’t configured correctly.
To resolve this, try fetching the page details first using notionClient.pages.retrieve(), then use that to construct your update payload. This ensures you’re working with the correct property structure:
I’ve run into similar issues with the Notion API before, and it can be pretty frustrating. From what I can see in your code, the problem might be related to how you’re constructing the properties object in your update call.
When updating a page, you need to match the structure of the existing properties. The error message suggests that the API is expecting a ‘body’ property with specific fields (id, name, start), but you’re not providing those.
This assumes ‘Summary’ is the actual name of the property in your Notion database. Also, make sure you’re using the latest version of the Notion SDK, as older versions might have different property structures.
If this doesn’t solve it, you might want to log the full structure of ‘page.properties’ to see exactly what properties your page has, and match that structure in your update call. Hope this helps!