algolia / gatsby-plugin-algolia

A plugin to push to Algolia based on graphQl queries
https://yarn.pm/gatsby-plugin-algolia
Apache License 2.0
178 stars 45 forks source link

Indexing won't come to an end #11

Closed MartinConde closed 6 years ago

MartinConde commented 6 years ago

Somehow when building it gets stuck when indexing to algolia. Left it running for about an hour and it just kept spinning. I was just testing it with 2 records so can't be the data I guess..

I am using Gatsby 2.4.1, this is my gatsby-config:

const myQuery = `{
  allDataJson {
    edges {
      node {
        slug
        name
      }
    }
  }
}`;

const queries = [
  {
    query: myQuery,
    transformer: ({ data }) => data.allDataJson.edges.map(({ node }) => node),
    indexName: 'testshop',
  },
];

module.exports = {
  siteMetadata: {
    title: 'Gatsby Default Starter',
  },
  plugins: [
    'gatsby-plugin-react-helmet',
    {
      resolve: `gatsby-plugin-algolia`,
      options: {
        appId: 'XXX',
        apiKey: 'XXX',
        indexName: "test",
        queries,
        chunkSize: 10000,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `data`,
        path: `${__dirname}/src/data`,
      },
    },
    `gatsby-transformer-json`,
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
  ],
}

I guess I am just missing something here but just can't spot why this wouldn't work. Any ideas or more infos you need? :)

Haroenv commented 6 years ago

Could you give a whole repo I can clone and try out? I’ve only tried it with v1 so far and I thought it should work with v2, but maybe you have a weird thing going on? Thanks

MartinConde commented 6 years ago

Sure, thanks a lot for looking into it! Here is the repo: https://github.com/MartinConde/AlgoliaTest.

Haroenv commented 6 years ago

I found what the issue is. If young already have a production index, it will be stuck copying forever since the operation is invalid. I'll fix that!

Haroenv commented 6 years ago

By the way @MartinConde, a way to go around that before #12 is merged & released is to simply on the dashboard once click "create index" with the name you plan on using.