Issue with API keys using Firebase Function and Algolia

Hi there:

I’m using the Fulltext-Search Firebase Function which utilises Algolia: https://github.com/firebase/functions-samples/tree/master/fulltext-search

However the docs aren’t quite clear about what to use for the API keys:

firebase functions:config:set algolia.key="mykey" algolia.secret="secret"

I’m currently using my Application ID for algolia.key and I’m using an API key that is restricted to the ‘users’ index with all the ACL settings ticked as my algolia.secret

However when I try and do an index from Firebase to Algolia, I’m given this error:

indexentry
AlgoliaSearchError: Invalid Application-ID or API key at success (/user_code/node_modules/algoliasearch/src/AlgoliaSearchCore.js:335:32) at process._tickDomainCallback (internal/process/next_tick.js:129:7)
 AlgoliaSearchError: Invalid Application-ID or API key
    at success (/user_code/node_modules/algoliasearch/src/AlgoliaSearchCore.js:335:32)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)

Any pointers on what I’ve done wrong?

EDIT: Make sure you use the admin key!

Looking at the function, any key with read and write access to the index in question should work. Maybe the problem was with creating the index initially?

Anyhow, glad you got it to work with the admin API key, just a reminder to always be careful where you deploy it :slight_smile: