TypeError: page is null after New Page

Builder content link

Builder public api key
8e92e0af177a4e248cd7b68172462c84

What are you trying to accomplish
I’m trying out builder, developing locally with a NEXTJS frontend, exactly followed the instructions on Integrating Pages - Builder.io
When I add a new page, the visual editor loads but instead of an empty page preview with the ‘Add Block’ button, it displays the error message:
Unhandled Runtime Error
TypeError: page is null
When I publish the page and then reload it, everything works great. But if I were to ship this to a client, they would obviously be confused and consider this a bug.

Screenshots or video link

Code stack you are integrating Builder with
NextJS, react

Thank you for any suggestions.

Hi @SimonF , welcome to the forum! Thank you for pointing this out. This is likely getting thrown when setting the <title> and you can add optional chaining to page to avoid this error.

<title>{page?.data.title}</title>

There was also another typo with revalidate and I’ve updated the Integrating Pages doc to reflect both these corrections. Let me know if you still need help!

1 Like

Thank you for the swift reply and updating the docs, that solved it!

1 Like