- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
配置 firebase 的简单应用程序 ...
import * as firebase from "firebase/app";
import 'firebase/auth';
const app = firebase.initializeApp(FIREBASE_CONFIG);
firebase.setLogLevel('debug');
app.auth().useDeviceLanguage();
app.auth().settings.appVerificationDisabledForTesting = __DEVELOPMENT__;
然后我配置数据库
import 'firebase/firestore';
const database = app.firestore();
database.settings({
host: 'localhost:8080',
ssl: true,
});
匿名用户
const handleAuthStateChanged = (user) => {
if (!user) {
firebase.auth().signInAnonymously();
}
}
app.auth().onAuthStateChanged(handleAuthStateChanged)
我试图获取一些数据
database.collection('events').doc(eventId).withConverter(eventConverter).get();
但是我收到这个错误
@firebase/firestore: Firestore (7.15.0): FirestoreClient Initializing. user=@firebase/firestore: Firestore (7.15.0): MemoryPersistence Starting transaction: Get next mutation batch@firebase/firestore: Firestore (7.15.0): MemoryPersistence Starting transaction: Allocate target@firebase/firestore: Firestore (7.15.0): MemoryPersistence Starting transaction: Execute query@firebase/firestore: Firestore (7.15.0): IndexFreeQueryEngine Using full collection scan to execute query: Query(target=Target(events/1, orderBy: [name (asc)]); limitType=F)@firebase/firestore: Firestore (7.15.0): PersistentStream close with error: FirebaseError: [code=unknown]: Fetching auth token failed: Cannot redefine property: refreshToken
@firebase/firestore: Firestore (7.15.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unknown]: Fetching auth token failed: Cannot redefine property: refreshToken
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
和
FirebaseError: Failed to get document because the client is offline.
如果你去.. https://nps-event.ridermansb.dev/event/1您会看到它正在运行。
但是本地不行
这里有完整的源代码
最佳答案
Firebase 允许用户将其身份验证 SDK 实现到您的 sign in method .通过查看您的代码,我可以看到 Firebase 身份验证 anonymous signin这里用到了方法。方法中好像少了错误处理方法。可以引用signInAonymously method添加错误处理方法的文档以获取有关错误的更多详细信息。
关于javascript - 火力地堡错误 : [code=unknown]: Fetching auth token failed: Cannot redefine property: refreshToken,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62307683/
我是一名优秀的程序员,十分优秀!