gatsby-plugin-algolia: Freezing builds on netlify

Since adding gatsby-plugin-algolia to some of my projects, they have been suffering from freezing builds on netlify. The build logs below show that the failing step is

8:20:30 PM: Algolia: query 1: moving copied index to main index

This happens on every 4th or 5th deploy, I’d say. Interestingly, so far this has never happened when building locally. So it’s very likely related to netlify in some way.

@Haroenv Can you tell from the logs what exactly could be causing this issue and how we might fix it?

8:20:23 PM: Algolia: 3 queries to index
8:20:24 PM: Algolia: query 2: copying existing index
8:20:24 PM: Algolia: query 0: copying existing index
8:20:24 PM: Algolia: query 1: copying existing index
8:20:26 PM: Algolia: query 2: executing query
8:20:26 PM: Algolia: query 2: splitting in 1 jobs
8:20:26 PM: Algolia: query 0: executing query
8:20:26 PM: Algolia: query 0: splitting in 1 jobs
8:20:28 PM: Algolia: query 1: executing query
8:20:28 PM: Algolia: query 1: splitting in 1 jobs
8:20:29 PM: Algolia: query 0: moving copied index to main index
8:20:30 PM: Algolia: query 1: moving copied index to main index
8:49:28 PM: error UNHANDLED EXCEPTION
8:49:29 PM: 
8:49:29 PM:   TypeError: Cannot read property 'id' of undefined
8:49:29 PM:   
8:49:29 PM: Build exceeded maximum allowed runtime
8:49:29 PM:   - nodes.js:21 module.exports
8:49:29 PM:     [repo]/[gatsby]/dist/redux/reducers/nodes.js:21:37
8:49:29 PM:   
8:49:29 PM:   - redux.js:451 combination
8:49:29 PM:     [repo]/[redux]/lib/redux.js:451:29
8:49:29 PM:   
8:49:29 PM:   - redux.js:211 dispatch
8:49:29 PM:     [repo]/[redux]/lib/redux.js:211:22
8:49:29 PM:   
8:49:29 PM:   - index.js:79 action
8:49:29 PM:     [repo]/[gatsby]/dist/redux/index.js:79:91
8:49:29 PM:   
8:49:29 PM:   - redux.js:468 Object.deleteNode
8:49:29 PM:     [repo]/[redux]/lib/redux.js:468:12
8:49:29 PM:   
8:49:29 PM:   - gatsby-node.js:150 emitter.on.action
8:49:29 PM:     [repo]/[gatsby]/dist/internal-plugins/internal-data-bridge/gatsby-node.js:15    0:23
8:49:29 PM:   
8:49:29 PM:   - mitt.js:1 
8:49:29 PM:     [repo]/[mitt]/dist/mitt.js:1:268
8:49:29 PM:   
8:49:29 PM:   - Array.map
8:49:29 PM:   
8:49:29 PM:   - mitt.js:1 Object.emit
8:49:29 PM:     [repo]/[mitt]/dist/mitt.js:1:252
8:49:29 PM:   
8:49:29 PM:   - index.js:102 store.subscribe
8:49:29 PM:     [repo]/[gatsby]/dist/redux/index.js:102:11
8:49:29 PM:   
8:49:29 PM:   - redux.js:220 dispatch
8:49:29 PM:     [repo]/[redux]/lib/redux.js:220:7
8:49:29 PM:   
8:49:29 PM:   - index.js:79 action
8:49:29 PM:     [repo]/[gatsby]/dist/redux/index.js:79:91
8:49:29 PM:   
8:49:29 PM:   - redux.js:468 
8:49:29 PM:     [repo]/[redux]/lib/redux.js:468:12
8:49:29 PM:   
8:49:29 PM:   - api-runner-node.js:48 doubleBoundActionCreators.(anonymous function).args
8:49:29 PM:     [repo]/[gatsby]/dist/utils/api-runner-node.js:48:13
8:49:29 PM:   
8:49:29 PM:   - gatsby-node.js:86 
8:49:29 PM:     [repo]/[gatsby-plugin-page-creator]/gatsby-node.js:86:19
8:49:29 PM:   
8:49:29 PM:   - Map.forEach
8:49:29 PM:   
8:49:29 PM: 
8:49:29 PM: Execution timed out after 15m0s
8:49:29 PM: Error running command: Command did not finish within the time limit
8:49:29 PM: Failing build: Failed to build site

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 19 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I seem to have solved this by refactoring to a single algolia query. we also experience the issue on another project, my current theory there is the _tmp index is being written to concurrently causing issues. planning to rename that temp index with a time stamp to test that theory out

I am still facing the same issue, my build is stuck/freeze at Algolia Query Indexing and copying.

Has anybody found any solution or workaround for this?

Screenshot 2020-03-22 at 3 39 18 PM

The workaround I found is to clear your indexes from Algolia and then run the build.

For me, the error appears when this code is included. So if I eliminate the lines marked with >>>>> I don’t see the error with the “id” property (code located in gatsby-node.esm.js)

exports.onCreatePage = ({ page, actions }) => {
  const { createPage, deletePage } = actions
  const oldPage = Object.assign({}, page)
  if (page.path !== `/`) page.path = page.path.replace(/\/$/, ``)
  if (/^.\d{4}\.\d{2}\.\d{2}\./.test(page.path)) page.path = '/' + page.path.split('.').pop()

>>>>>  if (page.path !== oldPage.path) {
>>>>>    deletePage(oldPage)
>>>>>    createPage(page)
>>>>>  }
}

Since this is not related to the plugin, I’ve submitted a question in gatsby