Using with Angular 17 SSR -> document is not defined on initializeAppCheck
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- angular, firebase, typescript
Hướng nghiên cứu
Bắt đầu bằng cách đọc docs/app-check.md và lần theo lệnh gọi initializeAppCheck được hiển thị trong @angular/fire/fesm2022/angular-fire.mjs, cùng với việc truy cập document trong stack trace Firebase App Check đã được báo cáo. Được xem là hoàn tất khi Angular SSR và prerendering hoàn thành mà không có lỗi document, đồng thời App Check vẫn tiếp tục được khởi tạo trong trình duyệt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version info
Angular:
17.0.8
Firebase:
10.7.1
AngularFire:
17.0.0
Other (e.g. Ionic/Cordova, Node, browser, operating system):
Node 18, Ionic 7, MacOS
How to reproduce these conditions
Steps to set up and reproduce
- New Angular 17 project
ng add @angular/fire@17ng add @angular/ssr- Set up App Check as per https://github.com/angular/angularfire/blob/master/docs/app-check.md
ng build
Debug output
⠇ Building...
ReferenceError: document is not defined
at makeDiv (/app/.angular/prerender-root/node_modules/@firebase/app-check/dist/esm/index.esm2017.js:1119:26)
at initializeV3 (/app/.angular/prerender-root/node_modules/@firebase/app-check/dist/esm/index.esm2017.js:1064:19)
at _ReCaptchaV3Provider.initialize (/app/.angular/prerender-root/node_modules/@firebase/app-check/dist/esm/index.esm2017.js:1255:9)
at _activate (/app/.angular/prerender-root/node_modules/@firebase/app-check/dist/esm/index.esm2017.js:1543:20)
at initializeAppCheck (/app/.angular/prerender-root/node_modules/@firebase/app-check/dist/esm/index.esm2017.js:1498:5)
at <anonymous> (app/.angular/prerender-root/c56c3be0-e454-4b23-bf7d-d028ecf276ec/node_modules/@angular/fire/fesm2022/angular-fire.mjs:216:44)
at <anonymous> (/app/.angular/prerender-root/c56c3be0-e454-4b23-bf7d-d028ecf276ec/node_modules/@angular/fire/fesm2022/angular-fire.mjs:148:57)
at _ZoneDelegate.invoke (/app/.angular/prerender-root/node_modules/zone.js/fesm2015/zone.js:368:26)
at _Zone.run (/app/.angular/prerender-root/node_modules/zone.js/fesm2015/zone.js:129:43)
at _NgZone.runOutsideAngular (/app/.angular/prerender-root/node_modules/@angular/core/fesm2022/core.mjs:1461
An unhandled exception occurred: document is not defined
Expected behavior
AngularFire should check if rendering on a browser before calling App Check code and RecaptchaV3 (which relies on document being available)
Actual behavior
No check is done, so when providing App Check, this above error occurs as soon as pre-rendering on the server happens and document is accessed but isn't available due to not running in a browser
- Ngôn ngữ chính
- TypeScript
- Star
- 7.8k
- Fork
- 2.2k
- Merge trung bình
- 3 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 5
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của angular/angularfire
-
comp: build/pipeline type: bug version: current (v17+)
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
angular/angularfire#3766 ·
-
comp: schematics type: bug version: current (v17+)
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
angular/angularfire#3768 ·
-
comp: docs type: chore version: current (v17+)
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
angular/angularfire#3764 ·
-
comp: firestore comp: ssr priority: P0 (critical) type: feature version: current (v17+)
angular/angularfire#3757 · 1 người được giao ·
-
Six `firebase` entry points have no `@angular/fire` equivalent, so their exports are unreachable Đang mởcomp: core type: feature
angular/angularfire#3755 · 1 người được giao ·
Tất cả issue của angular/angularfire
Issue tương tự
-
blocklist removal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
pastelsky/bundlephobia#1122 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100