angular / angular/angularfire

AppCheck Build Error During Prerender for Angular SSR

Đang mở
#3,128 9 bình luận 3 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
7.8k
Fork
2.2k
Merge trung bình
22 giờ 28 phút
Pull request đã merge (30 ngày)
6

Mô tả

### 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
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với phần khởi tạo AppCheck được nêu trong issue và tái hiện lỗi bằng `yarn prerender` dưới Angular SSR. Truy vết xem cấu hình AppCheck nào truy cập `document` trong quá trình prerendering; hoàn thành khi prerendering kết thúc mà không có lỗi `document is not defined`, đồng thời serving và development SSR vẫn tiếp tục hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
build-system, web-dev
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.