Could not save Firebase (FCM) server key


We currently implementing and setup everything for the push notifications. Unfortunately I stuck at the step where we have to add the FCM server key to our server. When we insert the key and click save the following error occurs: "Couldn't update plugin: Cannot read property 'indexOf' of undefined". I follow step by step the documentation so this should be fine.

Just to be sure. Here a screenshot of the input field:

Does someone has the same problem or can give me an advice how to proceed here?

Thank you


I think we had this issue fixed in 18.08.1. In that case, please update your server.


I seems like the bug still exists in 18.08.01 cause I used the newest version for our countly setup and also the version note in the left corner prooves this:

I can't setup the notifications for android when the FCM is not working. I'm a bit helpless here. What can I do?


Let's check your logs then. It's in countly/log/countly-api.log or in Server Logs plugin if you have it enabled.


This is what the log captured:

TypeError: Cannot read property 'indexOf' of undefined
at Promise (/var/www/html/countly/plugins/push/api/parts/endpoints.js:971:38)
at new Promise ()
at api.appPluginsUpdate (/var/www/html/countly/plugins/push/api/parts/endpoints.js:962:16)
at pluginManager.dispatch (/var/www/html/countly/plugins/pluginManager.js:245:48)
at promises.push.Promise (/var/www/html/countly/api/parts/mgmt/apps.js:239:33)
at new Promise ()
at Object.keys.forEach.k (/var/www/html/countly/api/parts/mgmt/apps.js:238:35)
at Array.forEach ()
at common.db.collection.findOne (/var/www/html/countly/api/parts/mgmt/apps.js:236:46)
at /var/www/html/countly/plugins/pluginManager.js:970:29
at result (/var/www/html/countly/node_modules/mongodb/lib/utils.js:414:17)
at session.endSession (/var/www/html/countly/node_modules/mongodb/lib/utils.js:401:11)
at ClientSession.endSession (/var/www/html/countly/node_modules/mongodb-core/lib/sessions.js:114:41)
at executeCallback (/var/www/html/countly/node_modules/mongodb/lib/utils.js:397:17)
at handleCallback (/var/www/html/countly/node_modules/mongodb/lib/utils.js:128:55)
at (/var/www/html/countly/node_modules/mongodb/lib/operations/collection_ops.js:544:5)
2018-11-06T12:18:00.135Z: ERROR [mgmt:apps] Error during plugin config updates for app XXXX: {} object, NaN

Maybe a missing package on ubuntu?


Ok, this must be something new. Could you give me access to your dashboard? You can send it to asa at or to our Slack channel: Last one preferable since it'd speed up things.

In case you can't, please attach full request payload & db.countly.apps.findOne(ObjectId("APP_ID")) mongo query result.


Ok, no need I guess. Apparently, we have the same issue on another server.


Ok so how should I proceed here? Should I wait for an answer from your side or can you give me any advice?

Thank you in advance


Hi Stephan, please wait for a fix from @artem - Possibly tomorrow :slight_smile:


Hi Stephan,

Here are 2 patches you can apply in case you need it ASAP. Or you can wait for our next small release (should be out this month).


Hi artem,

I applied your patches accordingly but got unfortunatley the same error. Do I have to flush a cache maybe to make this work? I also double checked the code files on our server and compared them with your patches.


Hi Stephan,

Sorry forgot to mention. After applying patches you'll need to run sudo grunt dist-all in countly folder, restart the server and clear browser caches.


Great! Now it works. Thank you