I keep running into this validation error when trying to update page properties in my Notion database using the JavaScript SDK.
The error message says:
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.'
}
Here’s what my code looks like:
async function modifyPages() {
const response = await notion.databases.query({ database_id: `${dbId}` });
response.results.forEach(async (item, idx) => {
let prop_id = item.properties.Description.id;
if (idx === 0) {
try {
const result = await notion.pages.update({
page_id: item.id,
properties: {
[prop_id]: {
type: "rich_text",
rich_text: {
"content": "hello world"
}
}
}
})
} catch (error) {
console.log(error.message)
}
}
})
}
modifyPages();
I’m confused about where this body validation issue is coming from and how to fix it. Can anyone help me understand what’s wrong with my request structure?