From a9f9e6e1d481d9b7515848fe411a57be1d0b6771 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Tue, 18 Apr 2023 16:59:18 -0700 Subject: [PATCH] dont call createNode on null --- .../gatsby-source-contentful/src/normalize.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/gatsby-source-contentful/src/normalize.js b/packages/gatsby-source-contentful/src/normalize.js index 41c42c601f64c..6ef8a70e03322 100644 --- a/packages/gatsby-source-contentful/src/normalize.js +++ b/packages/gatsby-source-contentful/src/normalize.js @@ -787,14 +787,20 @@ export const createNodesForContentType = async ({ }) entryNodes.forEach((entryNode, index) => { - create(entryNode, () => { - entryNodes[index] = undefined - }) + // entry nodes may be undefined here if the node was previously already created + if (entryNode) { + create(entryNode, () => { + entryNodes[index] = undefined + }) + } }) childrenNodes.forEach((entryNode, index) => { - create(entryNode, () => { - childrenNodes[index] = undefined - }) + // entry nodes may be undefined here if the node was previously already created + if (entryNode) { + create(entryNode, () => { + childrenNodes[index] = undefined + }) + } }) })