gridsome-starter-wordpress
gridsome-starter-wordpress copied to clipboard
TypeError: Cannot read property 'addReference' of undefined
(Originally posted this on gridsome, reposting here)
I'm using Gridsome ^0.3.0, and @gridsome/source-wordpress
, ^0.1.0, and I'm running into the following error upon running gridsome develop
:
TypeError: Cannot read property 'addReference' of undefined
at WordPressSource.fetchWordPressContent (/Users/andrew/code/SpiralPraxis/marketing/node_modules/@gridsome/source-wordpress/index.js:99:20)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
I've got a vanilla installation. I haven't modified any files except gridsome.config.js
, and that only to provide a URL to my wordpress site, which is enabled to serve wp-json endpoints.
Here's my config file:
module.exports = {
plugins: [{
use: '@gridsome/source-wordpress',
options: {
baseUrl: 'https://mywordpresssite.com', // required
typeName: 'WordPress', // GraphQL schema name (Optional)
perPage: 100, // How many posts to load from server per request (Optional)
concurrent: 10, // How many requests to run simultaneously (Optional)
routes: {
post: '/:year/:month/:day/:slug', //adds route for "post" post type (Optional)
post_tag: '/tag/:slug' // adds route for "post_tag" post type (Optional)
}
}
}]
}
Here's the relevant code from @gridsome/source-wordpress/index.js
:
for (const type in taxonomies) {
const options = taxonomies[type]
const typeName = makeTypeName(type)
const route = routes[type] || `/${options.rest_base}/:slug`
restBases.taxonomies[type] = options.rest_base
for (const type of options.types) {
const postTypeName = makeTypeName(type)
const collection = getContentType(postTypeName)
collection.addReference(options.rest_base, { typeName, key: '_id' })
}
addContentType({ typeName, route })
}
Not sure what to do. I can't see anything in the documentation that clarifies this issue. Help would be appreciated.