Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase App already exists #5

Open
alighafoorzade opened this issue Jan 26, 2019 · 2 comments
Open

Firebase App already exists #5

alighafoorzade opened this issue Jan 26, 2019 · 2 comments

Comments

@alighafoorzade
Copy link

alighafoorzade commented Jan 26, 2019

i'm using this package in adonis js and i use the code below:

const FCM = require('fcm-notification');
class NotificationController {
async send({request,response}){
const data = request.only(['api_key', 'login_tokens', 'title','body']);
let login_tokens = data.login_tokens;
let fcm_tokens = new Array();
login_tokens.forEach(async function(login_token){
fcm_token = await Notification.findBy('login_token',login_token);
fcm_tokens.push(fcm_token);
});
let message = {
notification:{
title : data.title,
body : data.body
}
}
const fcm = new FCM('./private-key.json');
return fcm;
fcm.sendMultipleToken(message,fcm_tokens,function(err,response){
if(err){
console.log('err:\n',err);
}else{
console.log('response:\n',response);
}
});
}
}
`
and i receive below error:
The default Firebase app already exists. This means you called initializeApp() more than once without providing an app name as the second argument. In most cases you only need to call initializeApp() once. But if you do want to initialize multiple apps, pass a second argument to initializeApp() to give each app a unique name.

@relu-xz
Copy link

relu-xz commented Jan 29, 2019

@alighafoorzade There is a pending PR:

#4

@dobrevnikolay
Copy link

The issue seems to be still present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants