Hey folks, I’m having a hard time getting my Airtable data to sync with Algolia when I build my Gatsby site. I’ve tried using the ‘gatsby-plugin-algolia’ plugin, but it’s not populating my Algolia index during the build process.
I can manually push data to Algolia using algoliasearch and a JSON file, but I want this process to run automatically on every build so that my Algolia index always reflects the current Airtable data.
Here’s a snippet of what I’ve tried in my gatsby-config.js file:
const customQuery = `{
productData: allAirtableLinked(filter: { table: { eq: \"Products\" } }) {
edges {
node {
id
data {
name
description
price
category
}
}
}
}
}`;
const queries = [
{
query: customQuery,
transformer: ({ data }) => data.productData.edges.map(({ node }) => node.data),
indexName: 'myProductIndex',
}
];
module.exports = {
plugins: [
{
resolve: 'gatsby-source-airtable-linked',
options: {
apiKey: process.env.AIRTABLE_API_KEY,
tables: [
{
baseId: process.env.AIRTABLE_BASE_ID,
tableName: 'Products',
tableView: 'Main View'
}
]
}
},
{
resolve: 'gatsby-plugin-algolia',
options: {
appId: process.env.ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_API_KEY,
indexName: 'myProductIndex',
queries,
chunkSize: 10000
}
}
]
};
Has anyone successfully used this plugin? Any tips on getting it to work would be super helpful. Thanks!