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

Version 0.6.0 - Method not allowed with this API key #50

Closed eshlox closed 4 years ago

eshlox commented 4 years ago

Hi!

I've updated the plugin from 0.5.0 to 0.6.0 and it does not work anymore. Should I update some index settings? 🤔 Current index ACL: addObject, deleteObject, editSettings. It works with the 0.5.0 version.

https://github.com/algolia/gatsby-plugin-algolia/commit/e587abe391ceaadbfab799a7ba3d4ec64c99311e

7:21:37 PM: Algolia: 1 queries to index
7:21:37 PM: error failed to index to Algolia
7:21:37 PM: 
7:21:37 PM:   AlgoliaSearchError: Method not allowed with this API key
7:21:37 PM:   
7:21:37 PM:   - AlgoliaSearchCore.js:377 success
7:21:37 PM:     [repo]/[gatsby-plugin-algolia]/[algoliasearch]/src/AlgoliaSearchCore.js:377:    32
7:21:37 PM:   
7:21:37 PM:   - runMicrotasks
7:21:37 PM:   
7:21:37 PM:   - task_queues.js:97 processTicksAndRejections
7:21:37 PM:     internal/process/task_queues.js:97:5
7:21:37 PM:   
7:21:37 PM:   - gatsby-node.js:32 async doQuery
7:21:37 PM:     [repo]/[gatsby-plugin-algolia]/gatsby-node.js:32:29
7:21:37 PM:   
7:21:37 PM:   - async Promise.all
7:21:37 PM:   
7:21:37 PM:   - gatsby-node.js:70 async Object.exports.onPostBuild
7:21:37 PM:     [repo]/[gatsby-plugin-algolia]/gatsby-node.js:70:5
7:21:37 PM:   
7:21:37 PM: 
7:21:38 PM: not finished onPostBuild - 1.093s
Haroenv commented 4 years ago

getSettings is required now too, sorry for not mentioning that in the changelog, that's my oversight!

eshlox commented 4 years ago

Thanks for the response! I've added settings ACL and it still does not work. 🤷‍♂

7:44:26 PM: Algolia: query 0: copying existing index
7:44:27 PM: error failed to index to Algolia
7:44:27 PM: 
7:44:27 PM:   AlgoliaSearchError: Index not allowed with this API key
7:44:27 PM:   
7:44:27 PM:   - AlgoliaSearchCore.js:377 success
7:44:27 PM:     [repo]/[gatsby-plugin-algolia]/[algoliasearch]/src/AlgoliaSearchCore.js:377:    32
7:44:27 PM:   
7:44:27 PM:   - runMicrotasks
7:44:27 PM:   
7:44:27 PM:   - task_queues.js:97 processTicksAndRejections
7:44:27 PM:     internal/process/task_queues.js:97:5
7:44:27 PM:   
7:44:27 PM:   - gatsby-node.js:85 async scopedCopyIndex
7:44:27 PM:     [repo]/[gatsby-plugin-algolia]/gatsby-node.js:85:22
7:44:27 PM:   
7:44:27 PM:   - gatsby-node.js:38 async doQuery
7:44:27 PM:     [repo]/[gatsby-plugin-algolia]/gatsby-node.js:38:7
7:44:27 PM:   
7:44:27 PM:   - async Promise.all
7:44:27 PM:   
7:44:27 PM:   - gatsby-node.js:70 async Object.exports.onPostBuild
7:44:27 PM:     [repo]/[gatsby-plugin-algolia]/gatsby-node.js:70:5
7:44:27 PM:   
7:44:27 PM: 
7:44:27 PM: not finished onPostBuild - 1.541s

It seems that the client.copyIndex operation fails: https://github.com/algolia/gatsby-plugin-algolia/blob/master/gatsby-node.js#L85 🤔

Any idea why this could happen? There is no big difference between version 0.5.0 and 0.6.0. According to the documentation, addObject ACL is required to make an index copy and it works with 0.5.0. 🤔

image

Haroenv commented 4 years ago

Index not allowed with this API key, this didn't change since 0.5.0, but you need to also allow the index Posts_tmp

eshlox commented 4 years ago

I added Posts_tmp and it works now. Thanks!