react-notion-x icon indicating copy to clipboard operation
react-notion-x copied to clipboard

Potential Notion API breakage

Open Hades32 opened this issue 1 year ago • 1 comments
trafficstars

Description

Thanks for this package, it has worked great so far. But since Yesterday (we didn't run the build a few days before that, so maybe earlier) we get this error

Error occurred prerendering page "/blog". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'a741637a-07bc-47d5-9114-ffffffffffa5')
    at B (file:///myCodeWebsite/node_modules/notion-utils/build/index.js:1:1602)
    at file:///myCodeWebsite/node_modules/notion-utils/build/index.js:1:7307
    at Array.flatMap (<anonymous>)
    at Ye (file:///myCodeWebsite/node_modules/notion-utils/build/index.js:1:6637)
    at getPreviewImageMap (myCodeWebsite\.next\server\chunks\9077.js:302:80)
    at Object.getCollectionData (myCodeWebsite\.next\server\chunks\9077.js:241:115)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getStaticProps (myCodeWebsite\.next\server\pages\blog.js:303:25)
    at async renderToHTML (myCodeWebsite\node_modules\next\dist\server\render.js:385:20)
    at async myCodeWebsite\node_modules\next\dist\export\worker.js:286:36
export const getStaticProps = async () => {
  const notionPosts = await notion.getCollectionData({
    collectionId: blogCollectionId,
    viewId: blogViewId,
  });

  return {
    props: {
      notionPosts,
    },
    revalidate: 10,
  };
};

Notion Test Page ID

todo

Hades32 avatar Aug 29 '24 10:08 Hades32

This is probably too late a response, but are you able to check what page a741637a-07bc-47d5-9114-ffffffffffa5 is?

You could try going to notion.so/a741637a07bc47d59114ffffffffffa5 in your browser. (I've taken the dashes out as that sometimes seems to cause errors)

I got a similar error and it was because there were pages in the Trash that react-notion-x was trying to render.

This is fixed by pull request #514. ~~You could try merging it manually into your repo if possible.~~

Edit: this pull request fixes it for me when running in the dev environment but I still get fatal errors related to trashed pages when building. #514 is now merged into the master branch - thank you!

cajakil avatar Oct 05 '24 18:10 cajakil

I believe https://github.com/NotionX/react-notion-x/pull/571 should resolve this. and https://github.com/NotionX/react-notion-x/pull/514

transitive-bullshit avatar Nov 01 '24 04:11 transitive-bullshit