sanity-io / sanity-template-nextjs-blog-comments

https://www.sanity.io/create?template=sanity-io/sanity-template-nextjs-blog-comments
83 stars 23 forks source link

TypeError being returned when the site loads #2

Open sgriffiths opened 3 years ago

sgriffiths commented 3 years ago

Im getting the following error after building and doing npm run dev: Screen Shot 2020-10-30 at 1 23 24 pm

If I return an empty object/array the page loads but there is no blog content. Perhaps there is a dependancy missing from the readme ?

Addtional notes Sanity is running fine .env.local created and 'SANITY_API_TOKEN' pointing to 'write' API token in sanity running latest npm/node and also tried with Yarn

Any help would be welcomed. The blog site is running fine on Vercel. Issue lies when trying to run this locally

brob commented 3 years ago

Sorry about the issue with this. An earlier version of the Starter didn't have the right env variable naming conventions for Next.js to run client side with the API. If you look at this updated .env template file and update your .env.local, it should clear things up locally:

https://github.com/sanity-io/sanity-template-nextjs-blog-comments/blob/main/template/.env.test

kongweiying2 commented 3 years ago

Could you update the starter on the website with these instructions? This problem chewed up a lot of time for me.

https://www.sanity.io/create?taskId=SyNOeWRyGZxOTULAdkJU&template=sanity-io%2Fsanity-template-nextjs-blog-comments