Algolia in Firebase cloud functions, using typescript : "algoliasearch has no call signatures"

Hello, i try to implement algoliasearch in my google function, but when i try to build i had an error

algola-game.trigger.ts:9:16 - error TS2349: This expression is not callable.
Type ‘typeof import(“C:/Users/***/functions/node_modules/algoliasearch/index”)’ has no call signatures.

I use it like that : const client = algoliasearch(env.algolia.appid, env.algolia.apikey);

I already have remove @types/algolia that is unused since release 4.1

“dependencies”: {
“algoliasearch”: “^4.1.0”,
“firebase-admin”: “^8.10.0”,
“firebase-functions”: “^3.6.0”

Any help welcome.

Hey Sixbras,

Can you share with me the way you are importing Algolia? Maybe would be cool to see the full snippet.

Note that, there is this example on our docs:


Hi Nuno,
All the sample that i fund are in js not typescript.

Here is my function code :

import * as functions from ‘firebase-functions’;
const env = functions.config();
import * as algoliasearch from ‘algoliasearch’;

import { EventType } from ‘…/…/utils/EventType’;
import { FunctionsUtils } from ‘…/…/utils/functions.utils’;

const client = algoliasearch(env.algolia.appid, env.algolia.apikey);
const index = client.initIndex(‘games’);

export const algoliaGameTrigger = functions.firestore.document(‘games/{id}’)

.onWrite(async (change, context) => {

    const eventType = FunctionsUtils.getEventType(change);
    switch (eventType) {

        case EventType.Create:
            return createOrUpdateGame(,;
        case EventType.Update:
            return createOrUpdateGame(,;
        case EventType.Delete:
            return deleteGame(;
            console.log('Unspecified event type. ', change);
            return null;

function createOrUpdateGame(objectID: string, game: any) {
if (game.isDeleted) {
return deleteGame(objectID);
return index.saveObject({


function deleteGame(id: string) {
return index.deleteObject(id);

Can you replace import * as algoliasearch from ‘algoliasearch’; by import algoliasearch from ‘algoliasearch’;?

As mentioned on the upgrade guide, importing the algoliasearch function via the wildcard (*) is no longer possible. You must import algoliasearch from the default export.


Thanks a lot Nuno, i read this line more than 200 times… and now it seems obvious.

1 Like