Open weiljx opened 7 years ago
Could you post your code? Are you getting any console errors?
I'm getting the same error, the promise stays pending and doesn't seem to return anything
@Nickersoft
Not hitting debugger or any console logs below the console.log(config)
// const config = process.env.FIREBASE_CONFIG
const config = {
apiKey: process.env.FIREBASE_API_KEY,
authDomain: process.env.FIREBASE_AUTH_DOMAIN,
databaseURL: process.env.FIREBASE_DATABASE_URL,
projectId: process.env.FIREBASE_PROJECT_ID,
storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.FIREBASE_MESSAGE_SENDER_ID,
serviceWorkerLocation: '/static',
onTokenFetched: (token) => console.log(token)
}
console.log(config)
Push.extend(PushFCM)
Push.config({
FCM: config
})
Push.FCM().then((fcm) => {
console.log(fcm)
debugger
fcm.getToken().then((token, error) => {
console.log(token)
console.log(error)
}, (error) => { console.log(error) })
.catch((tokenError) => {
throw tokenError
})
}).catch((initError) => {
console.log(initError)
throw initError
})
Same here. No console log or errors. Testing in latest chrome
Got it working. 😄 I used the firebase version of the serviceworker ("firebase-messaging-sw.js") instead of the packaged version from push-fcm-plugin.
@otbe can you specify?
So I did the same thing, I copy pasta'd the https://github.com/Nickersoft/push-fcm-plugin/blob/master/firebase-messaging-sw.js into a public directory to get it running, but it still wouldn't work.
Did you change the firebase versioning or something?
First Thanks for all of your effort on this. We have push.js working and are working to get this working with the browser closed through push messaging. Currently when we call
Push.FCM() the promise never returns. It shows the PromiseStatus as "pending". Would be interested if you have any thoughts.
Thanks