Currently trying to send data to Notion. Following the Guide here -https://www.youtube.com/watch?v=ec5m6t77eYM Time stamp 1:55:23 ish.
Trying to learn how to use API’s and was recommended this video as it goes through most of the get commands. it’s actually mint learning this stuff just cannot for the life of me understand these errors yet. if anyone can tell me what I should look out for in future that would be great. thanks.
The error:
Sending data to Notion
@notionhq/client warn: request fail {
code: ‘validation_error’,
message: ‘body failed validation. Fix one:\n’ +
‘body.children[0].embed should be defined, instead was undefined
.\n’ +
‘body.children[0].bookmark should be defined, instead was undefined
.\n’ +
‘body.children[0].image should be defined, instead was undefined
.\n’ +
‘body.children[0].video should be defined, instead was undefined
.\n’ +
‘body.children[0].pdf should be defined, instead was undefined
.\n’ +
‘body.children[0].file should be defined, instead was undefined
.\n’ +
‘body.children[0].audio should be defined, instead was undefined
.\n’ +
‘body.children[0].code should be defined, instead was undefined
.\n’ +
‘body.children[0].equation should be defined, instead was undefined
.\n’ +
‘body.children[0].divider should be defined, instead was undefined
.\n’ +
‘body.children[0].breadcrumb should be defined, instead was undefined
.\n’ +
‘body.children[0].table_of_contents should be defined, instead was undefined
.\n’ +
‘body.children[0].link_to_page should be defined, instead was undefined
.\n’ +
‘body.children[0].table_row should be defined, instead was undefined
.\n’ +
‘body.children[0].ai_block should be defined, instead was undefined
.\n’ +
‘body.children[0].table should be defined, instead was undefined
.\n’ +
‘body.children[0].column_list should be defined, instead was undefined
.\n’ +
‘body.children[0].column should be defined, instead was undefined
.\n’ +
‘body.children[0].heading_1 should be defined, instead was undefined
.\n’ +
‘body.children[0].heading_2 should be defined, instead was undefined
.\n’ +
‘body.children[0].heading_3 should be defined, instead was undefined
.\n’ +
‘body.children[0].paragraph should be defined, instead was undefined
.\n’ +
‘body.children[0].bulleted_list_item should be defined, instead was undefined
.\n’ +
‘body.children[0].numbered_list_item should be defined, instead was undefined
.\n’ +
‘body.children[0].quote should be defined, instead was undefined
.\n’ +
‘body.children[0].to_do should be defined, instead was undefined
.\n’ +
‘body.children[0].toggle should be defined, instead was undefined
.\n’ +
‘body.children[0].template should be defined, instead was undefined
.\n’ +
‘body.children[0].callout should be defined, instead was undefined
.\n’ +
‘body.children[0].synced_block should be defined, instead was undefined
.’
}
(node:10860) UnhandledPromiseRejectionWarning: APIResponseError: body failed validation. Fix one:
body.children[0].embed should be defined, instead was undefined
.
body.children[0].bookmark should be defined, instead was undefined
.
body.children[0].image should be defined, instead was undefined
.
body.children[0].video should be defined, instead was undefined
.
body.children[0].pdf should be defined, instead was undefined
.
body.children[0].file should be defined, instead was undefined
.
body.children[0].audio should be defined, instead was undefined
.
body.children[0].code should be defined, instead was undefined
.
body.children[0].equation should be defined, instead was undefined
.
body.children[0].divider should be defined, instead was undefined
.
body.children[0].breadcrumb should be defined, instead was undefined
.
body.children[0].table_of_contents should be defined, instead was undefined
.
body.children[0].link_to_page should be defined, instead was undefined
.
body.children[0].table_row should be defined, instead was undefined
.
body.children[0].ai_block should be defined, instead was undefined
.
body.children[0].table should be defined, instead was undefined
.
body.children[0].column_list should be defined, instead was undefined
.
body.children[0].column should be defined, instead was undefined
.
body.children[0].heading_1 should be defined, instead was undefined
.
body.children[0].heading_2 should be defined, instead was undefined
.
body.children[0].heading_3 should be defined, instead was undefined
.
body.children[0].paragraph should be defined, instead was undefined
.
body.children[0].bulleted_list_item should be defined, instead was undefined
.
body.children[0].numbered_list_item should be defined, instead was undefined
.
body.children[0].quote should be defined, instead was undefined
.
body.children[0].to_do should be defined, instead was undefined
.
body.children[0].toggle should be defined, instead was undefined
.
body.children[0].template should be defined, instead was undefined
.
body.children[0].callout should be defined, instead was undefined
.
body.children[0].synced_block should be defined, instead was undefined
.
at buildRequestError (/rbd/pnpm-volume/1ae46c8e-7572-4360-8bc6-f5c7840689da/node_modules/@notionhq/client/build/src/errors.js:162:16)
at Client.request (/rbd/pnpm-volume/1ae46c8e-7572-4360-8bc6-f5c7840689da/node_modules/@notionhq/client/build/src/Client.js:378:54)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async createNotionPage (/app/index.js:125:22)
(Use node --trace-warnings ...
to show where the warning was created)
(node:10860) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see Command-line API | Node.js v21.7.1 Documentation). (rejection id: 1)
(node:10860) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I don’t see where I have gone wrong. I understand the error to some extent and how it says stuff is undefined. But I do not see where this is the case. Before I added this last line of code in for the flavor text it worked perfectly and sending the data into Notion. don’t know where i went wrong. thanks in advance for any assistance.