gpt4 book ai didi

javascript - 火力地堡错误 : [code=unknown]: Fetching auth token failed: Cannot redefine property: refreshToken

转载 作者:行者123 更新时间:2023-12-05 06:15:57 27 4
gpt4 key购买 nike

配置 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您会看到它正在运行。

但是本地不行

这里有完整的源代码

https://github.com/Ridermansb/nps-event

最佳答案

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com