algolia / gatsby-plugin-algolia

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

not finished onPostBuild #55

Closed ahmetkuslular closed 4 years ago

ahmetkuslular commented 4 years ago

Hi, I created a simple gatsby project and integrated the algolia appropriately. But when I say yarn build. I get the following error.

Algolia: 1 queries to index
Algolia: query 0: executing query
⠴ onPostBuild
not finished onPostBuild - 0.493s

i can't make sense. What exactly is the problem?

my gatsyby.config


require("dotenv").config({
  path: `.env.${process.env.NODE_ENV}`,
})

const blogQuery = `
  {
    allMarkdownRemark {
      nodes {
        frontmatter {
          title
          date
          description
        }
        fields {
          slug
        }
        html
      }
    }
  }
`

const queries = [
  {
    query: blogQuery,
    transformer: ({ data }) => {
      return data.allMarkdownRemark.nodes;
    },
  },
]

module.exports = {
  siteMetadata: {
    title: `Gatsby Default Starter`,
    description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
    author: `@gatsbyjs`,
  },
  plugins: [
    {
      resolve: "gatsby-plugin-algolia",
      options: {
        appId: process.env.ALGOLIA_APP_ID,
        apiKey: process.env.ALGOLIA_API_KEY,
        indexName: process.env.ALGOLIA_INDEX_NAME,
        queries,
        chunkSize: 1000,
      },
    },
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/content/blog`,
        name: `blog`,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/content/assets`,
        name: `assets`,
      },
    },
    `gatsby-transformer-remark`,
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    },
  ],
}
Haroenv commented 4 years ago

I think the query could not be completed if the remark & filesystem plugins are executed after the algolia one. Can you try putting it last in the plugin list?

If you could put this reproduction in a GitHub repo with full configuration, that would help me find where that error / warning is coming from

ahmetkuslular commented 4 years ago

I think the query could not be completed if the remark & filesystem plugins are executed after the algolia one. Can you try putting it last in the plugin list?

If you could put this reproduction in a GitHub repo with full configuration, that would help me find where that error / warning is coming from

Sorry, it didn't work. There is a problem with the version.

0.7.0 --> working 0.8.0 --> not working

I found the problem. the control below gives this error but not the related error. I was able to get the ObjectID error when I tried in another project. I don't know what it changes.

  if (objects.length > 0 && !objects[0].objectID) {
      report.panic(
        `failed to index to Algolia. Query results do not have 'objectID' key`
      );
    }

I don't get an error when ObjectID passes properly.

Haroenv commented 4 years ago

Hi Ahmet, why have you closed this issue? Is there a different issue than what you said?

ahmetkuslular commented 4 years ago

Hi Ahmet, why have you closed this issue? Is there a different issue than what you said?

The error I received was from objectID. There are pass in v.0.8 that are done directly with objectID. so I thought it was okay and closed it.

yocmen commented 4 years ago

I have the same error, working on preview version.

ahmetkuslular commented 4 years ago

I have the same error, working on preview version.

The objectID required field in the new version(0.8). make sure you send it.