diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js index 9a3a35f6e1f2f..bdce362fde9df 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js @@ -134,7 +134,10 @@ const objectType = typeBuilderApi => { }) // if all child fields are excluded, this type shouldn't exist. - if (!Object.keys(transformedFields).length) { + // check null first, otherwise cause: + // TypeError: Cannot convert undefined or null to object at Function.keys () + // Also cause wordpress blog site build failure in createSchemaCustomization step + if (!transformedFields || !Object.keys(transformedFields).length) { return }