Gatsby: Gatsby develop hangs on createPagesStatefully

Created on 23 Sep 2019  ·  3Comments  ·  Source: gatsbyjs/gatsby

Description

I am having this problem too. Site is building fine until I drop this code into my gatsby-node.js:

exports.onCreatePage = ({ page, actions }) => {
  const { createPage, deletePage } = actions
  // get date
  let newDate = new Date()
  let date = newDate.getDate()
  let month = newDate.getMonth() 
  let year = newDate.getFullYear()
 const today = \`${year}-${month < 10 ? \`0${month}\` : \`${month}\`}-${date}\`
  console.log(today)

  deletePage(page)
  createPage({
    ...page,
    context: {
      ...page.context,
      currentDate: today,
    },
  })
}

(ignore the const today line as I had to escape characters for the comment markdown editor)
at which point running gatsby develop will freeze on createPagesStatefully.

Environment

Gatsby version: 2.15.18
Node v11.9.0
OS X Mojave

Actual output

~/sports ❯❯❯ gatsby develop                                                                                       ✘ 130 today ✱
success open and validate gatsby-configs - 0.048 s
success load plugins - 0.369 s
success onPreInit - 0.013 s
success initialize cache - 0.015 s
success copy gatsby files - 0.087 s
success onPreBootstrap - 0.024 s
success source and transform nodes - 4.600 s
success Add explicit types - 0.013 s
success Add inferred types - 0.182 s
success Processing types - 0.100 s
success building schema - 0.343 s
success createPages - 0.010 s
⠋ createPagesStatefully
question or discussion

Most helpful comment

Hi @jonniebigodes I'm also getting this error, and it just started happening after running yarn upgrade

Gatsby CLI version: 2.7.47
Gatsby version: 2.15.26
node -v 12.8.1
OS X 10.14.6

I'll try and setup a dummy site to recreate, but it does seem like a difference that happened after updating gatsby.

All 3 comments

@adamtyoung can you make a reproduction following these steps so that it can be looked at in more detail?

Sheesh--my bad. I'll blame it on Visual Studio, but was actually editing the wrong gatsby-node.js file (editing the one that I had created in a custom source plugin). Sorry and thanks--will close.

Hi @jonniebigodes I'm also getting this error, and it just started happening after running yarn upgrade

Gatsby CLI version: 2.7.47
Gatsby version: 2.15.26
node -v 12.8.1
OS X 10.14.6

I'll try and setup a dummy site to recreate, but it does seem like a difference that happened after updating gatsby.

Was this page helpful?
0 / 5 - 0 ratings