u12206050 / gridsome-plugin-algolia Goto Github PK
View Code? Open in Web Editor NEWA gridsome plugin to index objects to Algolia
License: MIT License
A gridsome plugin to index objects to Algolia
License: MIT License
Hello, thanks a lot for this plugin, I recently just added a modified
field in my frontmatter so i could use partial updates in the plugin, but when I try to build, I get this error:
Algolia collection #0: Executing query
Algolia collection #0: items in collection 5
Algolia collection #0: starting Partial updates
Algolia collection #0: found 6 existing items
Error: Algolia failed: ID is not defined at afterBuild (/home/edmund/projects/projects/my own/NinjaBlog/node_modules/gridsome-plugin-algolia/index.js:184:13)
This is how my config looks:
const collections = [
{
query: `{
allPost {
edges {
node {
id
title
path
modified
}
}
}
}`,
transformer: ({ data }) => data.allPost.edges.map(({ node }) => node),
indexName: process.env.ALGOLIA_INDEX_NAME, // Algolia index name
itemFormatter: item => {
return {
objectID: item.id,
title: item.title,
slug: item.path,
modified: String(item.modified)
};
}, // optional
matchFields: ['modified'] // Array<String> required with PartialUpdates
}
];
module.exports = {
plugins: [
{
use: `gridsome-plugin-algolia`,
options: {
appId: process.env.ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_ADMIN_KEY,
collections,
chunkSize: 10000, // default: 1000
enablePartialUpdates: true // default: false
}
]
}
I have my .env
file in place and all keys provided there.
I'm currently using the version 2.1.2
of the plugin.
While running gridsome develop
I got the following warning:
WARNING Deprecation notices
Avoid using api.store directly. Use the actions in api.loadSource() instead.
./node_modules/gridsome-plugin-algolia/index.js:2:17
Gridsome version: 0.7.9
Plugin Version: 2.1.2
Hello, I have a problem with rate limitations and Algolia. Netlify gives me the following error: Algolia: Response not successful: Received status code 429. Do you have any tips on how we can avoid this using your plugins in Gridsome?
Thanks
Hi there!
Thank you for taking time to port this plugin and contributing to Gridsome's plugin ecosystem. I was following your instruction of how to setup this plugin with my project. When I build the project however, I'm getting the following error:
Algolia collection #0: Executing query
Error: Algolia failed: report is not defined
I've searched the internet for a meaning of this error, found none! Can you please let me know what am I doing wrong?
Thank you, once again!
I have a .evn.development
with the following variables defined
ALGOLIA_APP_ID=123456789
ALGOLIA_API_KEY=123456789
ALGOLIA_INDEX_NAME=blog_posts
I know your instructions have an example where you require dotenv but it's already built into Gridsome. If you look at the docs it says that we should be able to use these values in our configuration https://gridsome.org/docs/environment-variables
When I use the actual values everything works fine but when I try to use the environment variables like so
{
use: `gridsome-plugin-algolia`,
options: {
appId: process.env.ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_API_KEY,
collections,
chunkSize: 10000, // default: 1000
enablePartialUpdates: false, // default: false
},
},
I get the following error:
AlgoliaSearchError: Please provide an application ID. Usage: algoliasearch(applicationID, apiKey, opts)
at AlgoliaSearchNodeJS.AlgoliaSearchCore (/Users/vega/dev/gridsome/danvega-dev/node_modules/algoliasearch/src/AlgoliaSearchCore.js:50:11)
at AlgoliaSearchNodeJS.AlgoliaSearch (/Users/vega/dev/gridsome/danvega-dev/node_modules/algoliasearch/src/AlgoliaSearch.js:11:21)
at AlgoliaSearchNodeJS.AlgoliaSearchServer (/Users/vega/dev/gridsome/danvega-dev/node_modules/algoliasearch/src/server/builds/AlgoliaSearchServer.js:17:17)
at new AlgoliaSearchNodeJS (/Users/vega/dev/gridsome/danvega-dev/node_modules/algoliasearch/src/server/builds/node.js:79:23)
at algoliasearch (/Users/vega/dev/gridsome/danvega-dev/node_modules/algoliasearch/src/server/builds/node.js:68:10)
at afterBuild (/Users/vega/dev/gridsome/danvega-dev/node_modules/gridsome-plugin-algolia/index.js:58:20)
at Promise.all.events.(anonymous function).map (/Users/vega/dev/gridsome/danvega-dev/node_modules/gridsome/lib/app/App.js:144:41)
at Array.map (<anonymous>)
at App.dispatch (/Users/vega/dev/gridsome/danvega-dev/node_modules/gridsome/lib/app/App.js:143:47)
at module.exports (/Users/vega/dev/gridsome/danvega-dev/node_modules/gridsome/lib/build.js:53:13)
This only happens on the build so these values should be injected. Any idea why this wouldn't work? I got a basic search working but until I can extract these values to env variables I can't push this code. Thanks again for the plugin!
Thanks for putting this together. When I run buildin gridsome, I'm getting this error:
Error: Algolia failed: report is not defined
at afterBuild (/Users/chrisemery/Sites/tbs-gridsome-2019/node_modules/gridsome-plugin-algolia/index.js:174:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
Any suggestions you might have to fix it would be greatly appreciated. Thanks.
Hello!
I'm getting this error when running gridsome build
. Indeed, the result from the GraphQL query is null, but running the same query in the Gridsome GraphQL playground returns the expected result, with actual posts.
From index.js, line 130, if I add a console.log
const result = await graphql(query);
console.log(result);
I end up with
{
data: [Object: null prototype] {
allDocPage: [Object: null prototype] { edges: [Array] }
}
}
Error: Algolia failed: Cannot read property 'map' of undefined
Any idea what could be happening here?
Do you have any examples of using this on a Gridsome blog somewhere? I am a little confused on the fields. Do you have an id in front matter for every single blog post? I don't generate IDs because they aren't being saved anywhere so I wonder if the slug is good enough.
Also, I don't have a modified date but it seems like I am going to need one because I don't want to regenerate this on every build. Do you have the modified field on every single blog post or just when one changes?
Thanks for creating this plugin!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.