angular / angular/angularfire

AppCheck Build Error During Prerender for Angular SSR

オープン
#3,128 コメント 9 件 リアクション 3 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
7.8k
フォーク
2.2k
平均マージ
22時間 28分
マージ済み PR(30日)
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` を実行して失敗を再現します。prerendering 中にどの AppCheck 設定が `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 を短くまとめたダイジェスト。