gridsome / gridsome/gridsome

Build fails only on Netlify: TypeError: Cannot read property 'title' of undefined

Open
#618 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
8.5k
Forks
466
PR merge metrics
No merged PRs in 30d

Description

I'm having issues with a build failing on Netlify that works fine locally. 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 Gridsome issue as a Netlify 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.

The most confusing part is that this works:

```js
{{ $page.meetingPage }}
```

But this does not:

```js
{{ $page.meetingPage.title }}
```

This is the build error:

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

My template:

```html


This is the page template

{{ $page.meetingPage.title }}


{{ $page.meetingPage.subtitle }}


{{ $page.meetingPage }}




```

My query:

```gql

query MeetingPage ($path: String!) {
meetingPage (path: $path) {
id
title
subtitle
description
content
}
}

```

Fine in GraphQL explorer locally:

![Screen Shot 2019-08-21 at 10 58 48 AM](https://user-images.githubusercontent.com/879292/63445423-54056b80-c406-11e9-92e1-e7d293a96ca5.png)

Fine in the browser locally:

![image](https://user-images.githubusercontent.com/879292/63445460-6384b480-c406-11e9-898c-1dbdd6b92137.png)

Fine in Vue devtools locally:

![Screen Shot 2019-08-21 at 10 59 23 AM](https://user-images.githubusercontent.com/879292/63445472-6a132c00-c406-11e9-8a66-648189137e09.png)

In case it matters, here's netlify.toml:

```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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.