HI! I have installed this extension and it works fine, I am able to do front-end search from my Firebase app with InstantSearch. BUT I need to generate restricted Algolia API keys so that each user can only see the results restricted to the documents they have access to.
I want to do this in Cloud Functions. When I initialize Algolia search and deploy it on Firebase, I get errors. I was wondering if this extension being installed automatically on Firebase makes other Algolia Cloud Functions in Firebase bug?
This is how I initialise Algolia in Firebase (Cloud Functions index.js):
// For the default version
const algoliasearch = require('algoliasearch');
const db = admin.firestore();
// For the default version
// import algoliasearch from 'algoliasearch';
// For the search only version
// import algoliasearch from 'algoliasearch/lite';
//obviously I use my Algolia app ID + amdin API key here
const client = algoliasearch('xxxxxxxxxx', 'xxxxxxxx');
const index = client.initIndex('profiles');
`
The weird thing is: if I deploy this index.js to Firebase (firebase deploy --only functions) without any functions, the deploy completes correctly. If I add ANY function, even when the function has nothing to do with Algolia, I get an error. If I deploy the file without the initialisation code of Algolia, all non-Algolia functions work obviously.
As the error is just "there was an error", I think it's more likely this behaviour is something in firebase and not just this extension, and thus you'll have more response contacting firebase support. Thanks!
HI! I have installed this extension and it works fine, I am able to do front-end search from my Firebase app with InstantSearch. BUT I need to generate restricted Algolia API keys so that each user can only see the results restricted to the documents they have access to.
I want to do this in Cloud Functions. When I initialize Algolia search and deploy it on Firebase, I get errors. I was wondering if this extension being installed automatically on Firebase makes other Algolia Cloud Functions in Firebase bug?
This is how I initialise Algolia in Firebase (Cloud Functions index.js):
` const functions = require("firebase-functions"); const admin = require('firebase-admin'); admin.initializeApp();
// For the default version const algoliasearch = require('algoliasearch');
const db = admin.firestore();
// For the default version // import algoliasearch from 'algoliasearch';
// For the search only version // import algoliasearch from 'algoliasearch/lite';
//obviously I use my Algolia app ID + amdin API key here const client = algoliasearch('xxxxxxxxxx', 'xxxxxxxx'); const index = client.initIndex('profiles'); `
The weird thing is: if I deploy this index.js to Firebase (firebase deploy --only functions) without any functions, the deploy completes correctly. If I add ANY function, even when the function has nothing to do with Algolia, I get an error. If I deploy the file without the initialisation code of Algolia, all non-Algolia functions work obviously.
This is the error I get in Firebase:
` use: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Functions deploy had errors with the following functions: writeToFirestore(us-central1) i functions: cleaning up build files...
Error: There was an error deploying functions `