Skip to content

Misleading error in gatsby-node for createPage (component property) #3771

@benjaminhoffman

Description

@benjaminhoffman

When using the boundActionCreators's createPage of the createPages API, I get the following error when I don't have a component property: TypeError: Path must be a string. Received undefined. This occurs even when I do have a path property! :)

This error makes it confusing to debug, esp for users new to gatsby-node.

Reproduce:

$ gatsby new gatsby-example-site

in gatsby-node.js, paste this:

 exports.createPages = ({boundActionCreators}) => {
  const { createPage } = boundActionCreators
  createPage({
    path: 'something'
  })
 }

You will get this error: Path must be a string. Received undefined

Then update the above code to:

...
  createPage({
    path: 'something',
    component: 'something-else',
  })
...

and you will get this error: This dependency was not found: * something-else in ./.cache/sync-requires.js

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions