firebase / firebase/firebase-js-sdk
Service messaging is not available
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### Operating System
Windows 10
### Browser Version
Chrome v118.0.5993.88
### Firebase SDK Version
9.9.4
### Firebase SDK Product:
Messaging
### Describe your project's tooling
I have a NextJS app (v12)
### Describe the problem
The problem is when i try to configure the firebase file, the following error is occuring:
Error: Service messaging is not available

I also have this error:

### Steps and code to reproduce issue
`Firebase.ts:`
```
import { initializeApp } from "firebase/app";
import { getMessaging, getToken } from "firebase/messaging";
const firebaseConfig = {
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGE_SENDER_ID,
appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID,
measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID
};
const app = initializeApp(firebaseConfig);
const messaging = getMessaging(app);
```
PS: I've seen some threads that recommend downgrading firebase to v8, but I'd like to keep it in v9. Is there any way to fix this?
Contributor guide
Assessment
This issue has not been assessed yet.