【问题标题】:ReferenceError: document is not defined - Firebase AppCheck with SvelteKitReferenceError:文档未定义 - Firebase AppCheck 与 SvelteKit
【发布时间】:2022-09-26 16:39:49
【问题描述】:

我正在尝试添加应用检查在我的SvelteKitweb应用程序,它给出了这个错误:

ReferenceError:文档未定义
在 makeDiv (C:\\Users...\\ecomm\\node_modules@firebase\\app-check\\dist\\index.cjs.js:1149:24)
在 initializeV3 (C:\\Users...\\ecomm\\node_modules@firebase\\app-check\\dist\\index.cjs.js:1094:17)
在 ReCaptchaV3Provider.initialize (C:\\Users...\\ecomm\\node_modules@firebase\\app-check\\dist\\index.cjs.js:1294:9)
在 _activate (C:\\Users...\\ecomm\\node_modules@firebase\\app-check\\dist\\index.cjs.js:1598:23)
在 Proxy.initializeAppCheck (C:\\Users...\\ecomm\\node_modules@firebase\\app-check\\dist\\index.cjs.js:1554:5)
在 C:/Users/.../ecomm/src/lib/firebase.ts:23:17
在异步实例化模块(file:///C:/Users/.../ecomm/node_modules/vite/dist/node/chunks/dep-1513d487.js:50330:9)


this question一样的问题,只是它不是 React 而是 SvelteKit

我的集成代码是:

import { initializeApp } from \"firebase/app\";
import { initializeAppCheck, ReCaptchaV3Provider } from \"firebase/app-check\";

const firebaseConfig = { *the app config* };

const app = initializeApp(firebaseConfig);

const appCheck = initializeAppCheck( app, {
   provider: new ReCaptchaV3Provider(\'*my public key*\'),
   isTokenAutoRefreshEnabled: true
});

有谁知道如何解决?谢谢

    标签: javascript node.js firebase sveltekit firebase-app-check


    【解决方案1】:

    我的节点 js 休息服务器也有同样的错误。有什么解决办法吗?

    为我的应用程序启用了应用程序检查,并使用“localhost”域创建了 reCAPTCHA 帐户。

    【讨论】:

    猜你喜欢
    • 2022-08-07
    • 2022-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-11
    • 2016-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多