You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've left the application untouched apart from the following:
In Dato I've created a new Model called News and populated it with some new blocks.
I've created one new record for the News collection
Fired up the application locally and everything is clean and running well
I noticed the dynamic page template for the demos 'posts' called {DatoCmsPost.slug}.js and tried to duplicate it for the News page
Created {DatoCmsNews.slug}.js and put the following very basic code within it:
import React from "react";
import { graphql } from "gatsby";
export default function NewsPage({ data }) {
const { datoCmsNews: news } = data;
return (
<div>
<h1>{news.title}</h1>
</div>
);
}
export const query = graphql`
query ($slug: String) {
datoCmsNews(slug: { eq: $slug }) {
title
}
}
`;
When I run yarn develop my terminal spits the following message out but continues to serve (apologies for the length, I just want to provide full context):
When you load up the homepage (localhost:8000) the error regarding the coverimage.large is shown:
Cannot read properties of null (reading 'large')
However when I go to the specific URL that includes the slug for the News article e.g. http://localhost:8000/news/news-article-slug it all loads fine and just displays the title, with no errors.
If I remove the {DatoCmsNews.slug}.js and rebuild then it's all fine again.
I'm pretty lost at this point and would greatly appreciate any help.
Many thanks
The text was updated successfully, but these errors were encountered:
Hey @theSolTrain, I followed your instructions and tried to replicate the error, but couldn't :( It seems to work fine on my machine with a schema like this:
Both the entry itself:
And the front page:
Seem to work fine?
Is that all you edited? I can't quite tell what's different between our configurations. Could you please share this demo repo with me, and also provide a link to the DatoCMS project URL so I can try it on your exact schema?
Hi folks,
I've created the Gatsby and Dato test site as a test for a production build.
I've left the application untouched apart from the following:
When I run
yarn develop
my terminal spits the following message out but continues to serve (apologies for the length, I just want to provide full context):When you load up the homepage (localhost:8000) the error regarding the
coverimage.large
is shown:However when I go to the specific URL that includes the slug for the News article e.g. http://localhost:8000/news/news-article-slug it all loads fine and just displays the title, with no errors.
If I remove the {DatoCmsNews.slug}.js and rebuild then it's all fine again.
I'm pretty lost at this point and would greatly appreciate any help.
Many thanks
The text was updated successfully, but these errors were encountered: