Closed lassiter closed 5 years ago
@lassiter I noticed 2 things in your log:
Segment key error - Can you check if you are providing a segment key?
WebpackError - Are you sure props.media
is an array, as it says here it is null?
WebpackError: Cannot read property 'map' of null ProjectMedia.js:45 ProjectMedia src/components/ProjectMedia.js:45:18
I realized my issue this morning looking at my data. Essentially, my content can have that media item or not and I didn't add an alternate rendering for when there are no media items. So, that's my bad on the rendering and that's been resolved with a quick add of:
// Alternate View, if projectMedia does not exists
if (projectMedia == null) {
return (
<div>
<Helmet>
<title>{`${title} - ${config.siteTitle}`}</title>
</Helmet>
<SEO pagePath={slug} projectNode={projectNode} projectSEO />
<Container>
<ProjectInfo title={title} tags={tags} />
<PageBody body={body} />
</Container>
</div>
)
}
I don't think Segment was the issue since it just logs segment prodKey must be at least 10 char in length
when it's not provided. Anyways, it builds now that I added that alternate view for one of my content types that doesn't have a media item.
Is the difference between building and develop a kind of lazy rendering
per say?
Yeah, develop doesn't try to render every page on your site like a build will so errors can creep into pages you're not actively looking at and not get discovered until a build happens.
Summary
I spun off a version of one of the gatsby starters which is a fork of the contentful gatsby starter but have ended up with a build problem. Essentially, it works as intended in
gatsby develop
but fails to compile html because of anull
value that I have no real idea to debug since it fails to compile withdebugger
and the logs I put in aren't exactly helpful due to my lack of knowlege of the inner workings of Gatsby. I searched the issues for a similar question but didn't see anything. Is this a @contentful-userland (@contentful) issue with their plugin or a gatsby compile issue?Relevant information
This is the build log with one console.log of a contentful data-point from an export.json file which I'm unsure of that particular file's purpose. It came with the starter and both have a version of it which is undocumented regarding it's purpose. The post "beach-day" was included in that export.json file but even if I delete the file, it still ends up in the build log. I'm not sure where it's caching or how to clear that part. I'm more interested in what's happening around that
null
just before it but am not sure how to go about debugging it specifically.It obviously compiles with
gatsby develop
locally and here is a screenshot to prove it.Environment (if relevant)
File contents (if changed)
I'm new to Gatsby, so I'm not sure what has changed and what hasn't:
gatsby-config.js
:package.json
:gatsby-node.js
:gatsby-browser.js
: I don't have this file.gatsby-ssr.js
: I don't have this file.