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:
[build]
command = "yarn run build"
publish = "dist"
functions = "src/functions"
NODE_ENV = "10.16.3"
[dev]
command = "yarn run develop"
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/:splat"
status = 200
My template:
<template>
<Layout>
<div>
<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 -->
</div>
</Layout>
</template>
My query:
<page-query>
query MeetingPage ($path: String!) {
meetingPage (path: $path) {
id
title
subtitle
description
content
}
}
</page-query>