Gridsome build fails on Netlify

I’m having issues with a build failing on Netlify that works fine locally with Netlify Dev (and without Netlify Dev). I’m doing the same exact thing for other content types in my site, and it all works fine. And again, everything works just fine locally.

It seems like just as much of a Netlify issue as a Gridsome issue, so I’m going to give it a shot here. Please let me know if I should move this question to a better category.

My main goal here is to figure out what’s different about the local environment and the Netlify build environment. I’m running Node 10.16.3 locally.

This is the build error:

10:37:11 AM: TypeError: Cannot read property 'title' of undefined

My netlify.toml:

  command = "yarn run build"
  publish = "dist"
  functions = "src/functions"
  NODE_ENV = "10.16.3"

  command = "yarn run develop"

  from = "/api/*"
  to = "/.netlify/functions/:splat"
  status = 200

My template:


      <h1>This is the page template</h1>

      <h1>{{ $page.meetingPage.title }}</h1>           <!-- error -->
      {{ $page.meetingPage.subtitle }}</i></p>         <!--  error -->
      <div v-html="$page.meetingPage.content" />       <!--  error -->

      <pre>{{ $page.meetingPage }}</pre>               <!--  this works fine -->


My query:

       query MeetingPage ($path: String!) {
        meetingPage (path: $path) {

Hi there!

Haven’t seen exactly that error before but I think we can guide you on debugging the build. I’d suggest that it is most likely a version mismatch between our build environment and yours. This article shows how we choose versions of node, npm, etc:

You’ll specifically notice that NODE_ENV should not be a version number, but production or development and you need instead NODE_VERSION for what you seem to be trying to accomplish.

…so a good first pass debugging move is to ensure that we use those same versions as you during build.

Once you’ve established that, if the error still happens, next steps for debugging are probably to run in our docker container locally so you can browse around and analyze what is installed, rerun failed commands verbosely, etc:

Let us know how it goes!

I ended up having to do some refactoring to change a different behavior that caused it to not exist anymore. I still never quite “solved” it though, so I’ll keep an eye out for it to return. Thanks!

1 Like

if it does come back, please let us know!