Gatsby/Sanity - error Page data from page-data.json for the failed page

I am having trouble deploying my Gatbsy + Sanity portfolio site.
Netlify URL: https://house-of-dinosaur-site-2022.netlify.app/

Here are the logs, something is going wrong with a variable somewhere when gatsby-config creates pages using project.js as the template. Potentially related to a GraphQL query.

I’d be so so grateful for any help with this, I can’t track down where I’m going wrong. Thank you.

EDITED TO LATEST ERROR TERMINAL OUTPUT

npm run build

> sanity-gatsby-portfolio-web@1.0.3 build
> gatsby build

success compile gatsby files - 0.523s
success load gatsby config - 0.031s
success load plugins - 1.481s
warn gatsby-plugin-react-helmet: Gatsby now has built-in support for modyfing
the document head. Learn more at https://gatsby.dev/gatsby-head
success onPreInit - 0.011s
success delete worker cache from previous builds - 0.004s
info One or more of your plugins have changed since the last time you ran
Gatsby. As
a precaution, we're deleting your site's cache to ensure there's no stale data.
info [sanity] Fetching remote GraphQL schema
info [sanity] Transforming to Gatsby-compatible GraphQL SDL
info [sanity] Stitching GraphQL schemas from SDL
success initialize cache - 0.505s
success copy gatsby files - 0.207s
success Compiling Gatsby Functions - 0.327s
success onPreBootstrap - 0.375s
success createSchemaCustomization - 0.021s
info [sanity] Fetching export stream for dataset
info [sanity] Done! Exported 62 documents.
success Checking for changed pages - 0.001s
success source and transform nodes - 0.798s
info Writing GraphQL type definitions to
/Applications/MAMP/htdocs/house-of-dinosaur-site-2022/web/.cache/schema.gql
success building schema - 0.538s
success createPages - 0.041s
success createPagesStatefully - 0.104s
info Total nodes: 203, SitePage nodes: 7 (use --verbose for breakdown)
success Checking for changed pages - 0.001s
success Cleaning up stale page-data - 0.002s
success onPreExtractQueries - 0.001s
success extract queries from components - 5.276s
success write out redirect data - 0.014s
success onPostBootstrap - 0.004s
info bootstrap finished - 14.143s
success write out requires - 0.041s
info [sanity] Fetching remote GraphQL schema
info [sanity] Fetching remote GraphQL schema
info [sanity] Fetching remote GraphQL schema
info [sanity] Transforming to Gatsby-compatible GraphQL SDL
info [sanity] Stitching GraphQL schemas from SDL
info [sanity] Transforming to Gatsby-compatible GraphQL SDL
info [sanity] Stitching GraphQL schemas from SDL
info [sanity] Transforming to Gatsby-compatible GraphQL SDL
info [sanity] Stitching GraphQL schemas from SDL
success Building production JavaScript and CSS bundles - 22.224s
success Building HTML renderer - 26.919s
success Execute page configs - 0.050s
success Caching Webpack compilations - 0.001s
success run queries in workers - 0.394s - 12/12 30.49/s
success Merge worker state - 0.004s
success Rewriting compilation hashes - 0.008s
info Wrote out 1 node page manifest file in 13 ms.
info unstable_createNodeManifest produced warnings [11802]. To see full
warning messages set process.env.VERBOSE_NODE_MANIFEST to "true".
Visit https://gatsby.dev/nodemanifest for more info on Node Manifests.
success Writing page-data.json files to public directory - 0.065s - 7/7
108.27/s
warn Invalid scope
warn Invalid scope

 ERROR 

Page data from page-data.json for the failed page
"/project/tom-test-project/": {
  "componentChunkName": "component---src-templates-project-js",
  "path": "/project/tom-test-project/",
  "result": {
    "data": {
      "sampleProject": {
        "id": "-0c8ef24c-3a97-552a-8c3e-4d2c5661d6f7",
        "publishedAt": "2022-08-18T12:53:00.000Z",
        "categories": [],
        "relatedProjects": [],
        "mainImage": {
          "crop": null,
          "hotspot": null,
          "asset": {
            "_id":
"image-620017ac3f9b7d425566a3ea60d5e4706a582a9e-1080x720-jpg"
          },
          "alt": "Alt Text"
        },
        "title": "Tom Test Project",
        "slug": {
          "current": "tom-test-project"
        },
        "_rawBody": [
          {
            "_key": "bf1a2645b23d",
            "_type": "block",
            "children": [
              {
                "_key": "6dda25251fd90",
                "_type": "span",
                "marks": [],
                "text": "It is a long established fact that a reader will be
distracted by the readable content of a page when looking at its layout. The
point of using Lorem Ipsum is that it has a more-or-less normal distribution
of letters, as opposed to using 'Content ..."
              }
            ],
            "markDefs": [],
            "style": "normal"
          }
        ],
        "members": []
      }
    },
    "pageContext": {
      "id": "-0c8ef24c-3a97-552a-8c3e-4d2c5661d6f7"
    }
  },
  "staticQueryHashes": [
    "2817707602",
    "4207246219"
  ],
  "manifestId":
"e95e39a5-883f-4027-9a44-4b95e821e6fb-2022-08-18T12:54:16.000Z"
}

failed Building static HTML for pages - 5.267s

 ERROR #95313 

Building static HTML failed for path "/project/tom-test-project/"

See our docs page for more info on this error: https://gatsby.dev/debug-html


  651 |   return function (v) {
  652 |     var el = value.current || value.nativeElement || value;
> 653 |     return toArray(v, el.querySelectorAll ? el : el === value ?
_warn("Invalid scope") || _doc.createElement("div") : value);
      | ^
  654 |   };
  655 | },
  656 |     shuffle = function shuffle(a) {


  WebpackError: TypeError: Cannot read properties of undefined (reading 
'createE  lement')
  
  - gsap-core.js:653 
    [sanity-gatsby-portfolio-web]/[gsap]/gsap-core.js:653:1
  
  - overlay-nav.js:23 
  
sanity-gatsby-portfolio-web/src/components/OverlayNav/overlay-nav.js:23:19
  
  - index.js:6 
    [sanity-gatsby-portfolio-web]/[date-fns]/esm/toDate/index.js:6:1
  
  - index.js:9 
    [sanity-gatsby-portfolio-web]/[date-fns]/esm/toDate/index.js:9:1
  
  - index.js:15 
    [sanity-gatsby-portfolio-web]/[date-fns]/esm/toDate/index.js:15:1
  
  - index.js:14 
    [sanity-gatsby-portfolio-web]/[date-fns]/esm/toDate/index.js:14:1
  
  - index.js:25 
    [sanity-gatsby-portfolio-web]/[date-fns]/esm/toDate/index.js:25:1
  
  - static-entry.js:303 
    sanity-gatsby-portfolio-web/.cache/static-entry.js:303:22
  
  - builder.js:154 
  
[sanity-gatsby-portfolio-web]/[@sanity]/image-url/lib/node/builder.js:154:1

Hi @tomwrankmore,

Thanks for reaching out!

I see the last successful build was on July 1. Were any changes made to the code between your last successful build and when you started to have the failed builds?

Are you able to build locally?

The error message here, suggest that the error is within /project/tom-test-project/. Were any changes made to that file prior to you have failed builds?