I've got a simple HTML element in Bubble.io that I'm trying to run javascript from.
Here's the error:
Uncaught Error: Service messaging is not available
at Provider.getImmediate (provider.ts:130:15)
at getMessagingInWindow (api.ts:64:61)
at about:blank:35:19
and here's the pseudocode:
<script type="importmap">
{
"imports": {
"firebase/app": "https://www.gstatic.com/firebasejs/9.6.6/firebase-app.js",
"firebase/messaging": "https://www.gstatic.com/firebasejs/9.6.9/firebase-messaging.js"
}
}
</script>
<script type="module">
import { initializeApp } from 'firebase/app';
import { getMessaging } from 'firebase/messaging';
const firebaseConfig = {
//...my config
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const messaging = getMessaging(app); // ERROR HERE
console.log(messaging)
</script>
Has anyone solved this? How can I run the push notifications script from a bubble page?
The versions of your Firebase SDK imports are mismatched. Make sure they are always the same version. It's also a good idea to make sure you're on the latest.