cstrnt / notion-api

Unofficial Notion.so API

Home Page:https://www.npmjs.com/package/notion-api-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Didn't work

laurensiusadi opened this issue · comments

I do the setup of putting the token and userId, then ran it but got some error.
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'recordMap' of undefined
Turns out there's no response in fetch.js. It seems something's missing.

I added a catch clause to that which should at least catch that error.
Maybe you could try again and provide some steps for reproduction?

Repro steps:

  1. insert token_v2 on index.js
  2. adding getPageById method on index.js:
api.getPageById('_PAGE_ID_GOES_HERE_').then(response => {
  console.log(response)
})
  1. Run npm start
TypeError: Cannot read property 'block' of undefined
    at fetch.then.r (D:\Dev\notion-api\src\notion.js:52:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)
undefined

Apparently I make a mistake on the PAGE_ID, it should be formatted to uuid.v4 with dashes
1de563e0bb234a3ab4c84fa0b6acb9dc -> 1de563e0-bb23-4a3a-b4c8-4fa0b6acb9dc