angular / angular/angularfire

AppCheck Build Error During Prerender for Angular SSR

未关闭
#3,128 9 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
7.8k
派生
2.2k
平均合并
22 小时 28 分钟
30 天内合并 PR
6

描述

### Version info

**Angular:** 13.0.3

**Firebase:** 9.6.4

**AngularFire:** 7.2.0

**Other (e.g. Ionic/Cordova, Node, browser, operating system):** Node 14

### How to reproduce these conditions
**Steps to set up and reproduce**

After setting up AppCheck as such:

```typescript

import { initializeAppCheck, provideAppCheck, ReCaptchaV3Provider } from '@angular/fire/app-check';

provideAppCheck(() => initializeAppCheck(getApp(), { provider: new ReCaptchaV3Provider(environment.recaptchaSiteKey), isTokenAutoRefreshEnabled: true })),
```

I am able to serve my application with both `yarn server` and `yarn dev:ssr` and I'm able to load the site with AppCheck seemingly working. However, when I try to run `yarn prerender`, I get the following error:

```
Unhandled Promise rejection: document is not defined ; Zone: ; Task: Promise.then ; Value: ReferenceError: document is not defined
```

贡献指南

打开贡献指南

调研方向

从 issue 中展示的 AppCheck 初始化开始,并在 Angular SSR 下使用 `yarn prerender` 重现该失败。跟踪哪个 AppCheck 设置在 prerendering 期间访问了 `document`;当 prerendering 在没有 `document is not defined` 错误的情况下完成,并且 serving 和开发 SSR 继续正常工作时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
build-system, web-dev
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。