Closed maggie44 closed 3 years ago
Hi, I'm getting a similar error with FeatureRowsGroup
when a link is not provided. I assume the Link object is not compulsory?.
I'll use the hero for now. It doesn't have such issues, but it would be nice to try this too.
Cheers
Server Error
TypeError: Cannot read property 'startsWith' of null
components/elements/custom-link.js (6:34) @ CustomLink
4 |
5 | const CustomLink = ({ link, children }) => {
> 6 | const isInternalLink = link.url.startsWith('/')
| ^
7 |
8 | // For internal links, use the Next.js Link component
9 | if (isInternalLink) {
I was getting the following error message:
`[ ==] info - Generating static pages (1/7) Error occurred prerendering page "/home". Read more: https://err.sh/next.js/prerender-error TypeError: Cannot read property 'mime' of null at /tmp/learners-block-website/frontend/.next/server/pages/[[...slug]].js:2487:20 at Array.map ()
at FeatureRowsGroup (/tmp/learners-block-website/frontend/.next/server/pages/[[...slug]].js:2468:20)
at d (/tmp/learners-block-website/frontend/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:498)
at $a (/tmp/learners-block-website/frontend/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
at a.b.render (/tmp/learners-block-website/frontend/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
at a.b.read (/tmp/learners-block-website/frontend/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
at renderToString (/tmp/learners-block-website/frontend/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:364)
at Object.renderPage (/tmp/learners-block-website/frontend/node_modules/next/dist/next-server/server/render.js:50:851)
at Function.getInitialProps (/tmp/learners-block-website/frontend/.next/server/pages/_document.js:305:19)
info - Generating static pages (7/7)
Turns out there are a bunch of fields that are compulsory, but not set as such in Strapi. This one was cause by Media in a FeatureRowsGroup. I have encountered at least one more but not been able to reproduce it to identify which caused the issue.
I'm not familiar enough with the platform, but either making these fields compulsory in Strapi, or coding in some defaults to stop it erroring would be helpful.