NextJS我可以整合Firebase Cloud Messaging
我会遇到此错误未接受的拒绝:FirebaseError:消息传递:此浏览器不支持使用Firebase SDK所需的API。 (消息传递/不支持的浏览器)。
这是我的配置:
firebase_config/config.js
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getMessaging } from "firebase/messaging";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
.....
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
// Initialize Firebase Cloud Messaging and get a reference to the service
const messaging = getMessaging(app);
export default app;
pages/firebase.js
import React from "react";
import app from "../firebase_config/firebase_config";
const firebase = () => {
return (
<div>
<h1>Firebase</h1>
</div>
);
};
export default firebase;
I am getting this error unhandledRejection: FirebaseError: Messaging: This browser doesn't support the API's required to use the Firebase SDK. (messaging/unsupported-browser).
Here is my configurations:
firebase_config/config.js
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getMessaging } from "firebase/messaging";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
.....
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
// Initialize Firebase Cloud Messaging and get a reference to the service
const messaging = getMessaging(app);
export default app;
pages/firebase.js
import React from "react";
import app from "../firebase_config/firebase_config";
const firebase = () => {
return (
<div>
<h1>Firebase</h1>
</div>
);
};
export default firebase;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论