I’m trying out a trigger which adds an object to algolia upon inserting to mongodb. In my case the object gets added to algolia successfully but the function doesn’t seem to stop and runs until timeout
My function
exports = function(changeEvent) {
const algoliasearch = require('algoliasearch');
const client = algoliasearch(context.values.get('algolia_app'),context.values.get('algolia_key'));
const index = client.initIndex("movies");
changeEvent.fullDocument.objectID = changeEvent.fullDocument._id;
delete changeEvent.fullDocument._id;
index.saveObject(changeEvent.fullDocument)
.then(({objectID}) => {
console.log('successfully updated: ',objectID);
})
.catch(err => {
console.log(err);
});
};
Log
Logs:
[
"successfully inserted: 61cf0a79c577393620dd8c80"
]
Error:
execution time limit exceeded
I’m I doing anything wrong