Ashbury
Ashbury

Reputation: 2346

"gatsby-node.js" created a page and didn't pass the path to the component

I'm trying to use prismic and gatsby to dynamically generate some pages following this tutorial. I created the UID in prismic, and it looks like it's sending the path, but I get the following error:

ERROR #11322

Your site's "gatsby-node.js" created a page and didn't pass the path to the component.

The page object passed to createPage:

{
    "path": "/heatx",
    "context": {
        "id": "Prismic__Article__XkTInhAAACIAtG2G"
    }
}

As you can see... it has a path. What am I doing wrong?

Upvotes: 1

Views: 1085

Answers (2)

Jasbir Singh
Jasbir Singh

Reputation: 11

It may also be the reason for typing 'component' as 'components'. As it was in my case. Hope you do not make a typing mistake.

Upvotes: 1

Ashbury
Ashbury

Reputation: 2346

Ah, the problem was that I wasn't giving the component the template correctly:

 const pageTemplates = {
    Article: path.resolve('./src/templates/article.jsx'),
  }

  pages.data.allPrismicArticle.edges.forEach(edge => {
    createPage({
      path: `/${edge.node.uid}`,
      component: pageTemplates.Article,
      context: {
        id: edge.node.id,
      },
    })
  })
}

Upvotes: 3

Related Questions