TypeError: Cannot read property 'typeName' of undefined
See original GitHub issueDescription
Seeing non-descriptive error (below) on gridsome build
and gridsome develop
.
TypeError: Cannot read property 'typeName' of undefined
at fieldValue (.../node_modules/gridsome/lib/graphql/createFieldDefinitions.js:43:23)
at fieldValues (.../node_modules/gridsome/lib/graphql/createFieldDefinitions.js:26:16)
at createFieldDefinitions (.../node_modules/gridsome/lib/graphql/createFieldDefinitions.js:9:14)
at module.exports.store (.../node_modules/gridsome/lib/graphql/nodes/index.js:14:20)
at module.exports.store (.../node_modules/gridsome/lib/graphql/createSchema.js:7:41)
at App.createSchema (.../node_modules/gridsome/lib/app/App.js:168:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
Expected result
Build is successful.
Environment
package.json:
{
"name": "siteName",
"private": true,
"scripts": {
"build": "gridsome build",
"develop": "gridsome develop",
"explore": "gridsome explore"
},
"dependencies": {
"@gridsome/source-contentful": "^0.3.0",
"gridsome": "^0.6.4",
"vue-showdown": "^2.4.1"
},
"devDependencies": {
"gridsome-plugin-purgecss": "^1.0.12",
"gridsome-plugin-tailwindcss": "^1.3.2"
}
}
gridsome.config.js
module.exports = {
siteName: 'SiteName',
plugins: [
{
use: 'gridsome-plugin-tailwindcss'
},
{
use: 'gridsome-plugin-purgecss'
},
{
use: '@gridsome/source-contentful',
options: {
space: process.env.xyz,
accessToken: process.env.xyz,
host: 'cdn.contentful.com',
environment: 'master',
typeName: 'Contentful',
routes: {
'Tag': '/tags/:slug',
'Article': '/articles/:slug',
'Page': ':slug'
}
}
}
]
}
For Tooling issues:
- Node version: v10.14.2
- Platform: Mac
Notes:
- Ran npm install/update today and noticed @gridsome/source-contentful had been updated today but unsure if that’s related.
- Tried upgrading/downgrading Gridsome and Contentful in package.json
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >TypeError: Cannot read property 'type' of undefined Error ...
Your reducer function needs order the state first and action after. const rootReducer = combineReducers({ battle: manageBattle, ...
Read more >TypeError: Cannot read property 'typeName' of undefined - APIs
I am using GraphQL to query data from Contentful within Gridsome. After deleting a field in one of my content types I can...
Read more >How to Avoid the Infamous "Cannot read properties of ... - Bitovi
Interpreting undefined or null as subtypes of all other types can lead to runtime problems. For example, if you try to get the...
Read more >Cannot read properties of undefined (reading 'type') - MongoDB
I am getting an error similar to TypeError: Cannot read properties of undefined (reading 'startsWith') with a different variable but same ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This didn’t solve my issue, since the photo was completely deleted (non recoverable). It’s not helpful that the build doesn’t give a decent pointer. For those encountering this, I’ve change lines 75:81 in the gridsome/lib/graphql/createFieldDefinitions.js (v 0.7.16) into:
Which at least points into the right direction. This way I was able to find the deleted photos which were linked in other entries.
This was a huge help and a great improvement. You should submit this as a PR. Thanks a lot!