Next.js Discord

Discord Forum

Error fetching data from Hygraph CMS

Answered
Pataco80 posted this in #help-forum
Open in Discord
Avatar
Good morning,

I'm learning Next.js and I need a free headless CMS for a client's project. I found Hygraph which strongly resembles Strapi while being hosted online. In the middle of the training project, an error appeared concerning the destructuring of data as soon as it arrived on the page. The error is: Unhandled Runtime Error
Error: Cannot destructure property 'page' of '(intermediate value)' as it is null.

app/page.tsx (65:14) @pageData

63 |
64 | export default async function Home() {
65 | const {page:pageData} = await getPageData()
| ^
66 | /* eslint-disable */console.log(...oo_oo(3607466385_66_2_66_23_4,pageData))
67 | return (

I'm wondering about eslint, I have the impression that it crashes. Does anyone have any advice on a clean configuration for Next.js and TypeScript on VS Code? My repository is located here: https://github.com/Pataco80/Portfolio-com-NextJs-13.

The training I follow is this:https://www.youtube.com/playlist?list=PLY_G6KZ7jlfU41bdaWpTsOnfCC7bmpJcL

Thanks for your help.
Answered by Pataco80
✅ problem resolved
it was a typo in the graphQL request on the home page of the final repository on github:
https://github.com/GBDev13/portfolio-tutorial-2023
View full answer

1 Reply

Avatar
✅ problem resolved
it was a typo in the graphQL request on the home page of the final repository on github:
https://github.com/GBDev13/portfolio-tutorial-2023
Answer