Google cloud function stopped working not showing results

The function bellow was working fine and then stopped working. I am not sure why, please take a look:

    exports.searchentry = functions.database.ref('/search/{userid}/query/text').onWrite(event => {
  const index = client.initIndex(ALGOLIA_JOBS_INDEX_NAME);
  const query = event.data.val();
  const key = event.data.key;
  const uid = event.params.userid;
  return index.search({
    query,
    attributesToRetrieve: [],
    attributesToHighlight: [],
  }).then(content => {
      const updates = {
        '/search/last_query_timestamp': Date.parse(event.timestamp)
      };
      updates[`/search/${uid}/results/${key}`] = content;
      return admin.database().ref().update(updates);
    });
});

Hi there,

This should still work.
Do you have some logs on what is happening? What is the result of those call? Could you add some debug to see what is happening?

Best,

Hello, I found the error if you see the line

attributesToHighlight: ,

there is an extra comma.

so, removing the comma fixes the issue. Fix bellow:

  exports.searchentry = functions.database.ref('/search/{userid}/query/text').onWrite(event => {
  const index = client.initIndex(ALGOLIA_JOBS_INDEX_NAME);
  const query = event.data.val();
  const key = event.data.key;
  const uid = event.params.userid;
  return index.search({
    query,
    attributesToRetrieve: [],
    attributesToHighlight: []
  }).then(content => {
      const updates = {
        '/search/last_query_timestamp': Date.parse(event.timestamp)
      };
      updates[`/search/${uid}/results/${key}`] = content;
      return admin.database().ref().update(updates);
    });
});