Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

"No Firebase App '[DEFAULT]' has been created" when using " provideFirebaseApp(() => initializeApp(environment.firebase))," in app.module.ts imports array, getStorage()

未關閉
#3,443 21 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
angular, firebase, typescript
領域
cloud

研究方向

在 app.module.ts 中使用 provideFirebaseApp(() => initializeApp(environment.firebase)),並使用一個呼叫 getStorage() 的儲存服務來重現此問題。追蹤 Firebase no-app 堆疊追蹤中顯示的初始化與服務存取順序。當儲存服務能正常運作且不出現 default-app 錯誤時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

comp: storage needs: investigation type: bug version: legacy (v7-v16)
Version info

Angular:
^16.2.0

Firebase:
^10.4.0

AngularFire:
^7.6.1

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

How to reproduce these conditions

Steps to set up and reproduce
Create Angular app via ng new appName, add Angularfire with ng add @angular/fire, initialize Firebase app in app.module.ts using the following in the imports array:

provideFirebaseApp(() => initializeApp(environment.firebase)),
Then, integrate firebase app via environments (create with ng add environment if needed), add storage service that connects to storage bucket via getStorage()

Debug output

ERROR Error: Uncaught (in promise): FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app).
FirebaseError@http://localhost:4200/vendor.js:73648:5
create@http://localhost:4200/vendor.js:73676:19
getApp@http://localhost:4200/vendor.js:154432:25
getStorage@http://localhost:4200/vendor.js:72546:80
4886/ɵzoneWrap/</ret<@http://localhost:4200/vendor.js:1279:44
4886/runOutsideAngular/<@http://localhost:4200/vendor.js:1211:57
invoke@http://localhost:4200/polyfills.js:8209:158
run@http://localhost:4200/polyfills.js:7994:35
runOutsideAngular@http://localhost:4200/vendor.js:108406:24
runOutsideAngular@http://localhost:4200/vendor.js:1211:33
4886/ɵzoneWrap/<@http://localhost:4200/vendor.js:1279:34
StorageService@http://localhost:4200/main.js:914:85
StorageService_Factory@http://localhost:4200/main.js:918:12
1699/hydrate/<@http://localhost:4200/vendor.js:106890:33
runInInjectorProfilerContext@http://localhost:4200/vendor.js:98413:5
hydrate@http://localhost:4200/vendor.js:106889:37
get@http://localhost:4200/vendor.js:106769:23
get@http://localhost:4200/vendor.js:111362:32
lookupTokenUsingModuleInjector@http://localhost:4200/vendor.js:102129:31
getOrCreateInjectable@http://localhost:4200/vendor.js:102175:10
ɵɵdirectiveInject@http://localhost:4200/vendor.js:109230:38
ProductsComponent_Factory@http://localhost:4200/main.js:640:211
getNodeInjectable@http://localhost:4200/vendor.js:102369:38
createRootComponent@http://localhost:4200/vendor.js:111603:48
create@http://localhost:4200/vendor.js:111470:19
createComponent@http://localhost:4200/vendor.js:121503:43
activateWith@http://localhost:4200/vendor.js:145921:31
activateRoutes@http://localhost:4200/vendor.js:146519:28
7947/activateChildRoutes/<@http://localhost:4200/vendor.js:146473:12
activateChildRoutes@http://localhost:4200/vendor.js:146472:25
activate@http://localhost:4200/vendor.js:146383:10
7947/activateRoutes/<@http://localhost:4200/vendor.js:146367:120
9736/map/</<@http://localhost:4200/vendor.js:82387:31
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
3738/tap/</<@http://localhost:4200/vendor.js:83039:18
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
9736/map/</<@http://localhost:4200/vendor.js:82387:18
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
1891/switchMap/</</innerSubscriber<@http://localhost:4200/vendor.js:82897:243
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
9736/map/</<@http://localhost:4200/vendor.js:82387:18
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
384/fromArrayLike/<@http://localhost:4200/vendor.js:81823:18
_trySubscribe@http://localhost:4200/vendor.js:80744:19
2235/subscribe/<@http://localhost:4200/vendor.js:80738:113
errorContext@http://localhost:4200/vendor.js:83975:5
subscribe@http://localhost:4200/vendor.js:80733:69
9736/map/<@http://localhost:4200/vendor.js:82386:12
4114/operate/</<@http://localhost:4200/vendor.js:84264:18
2235/subscribe/<@http://localhost:4200/vendor.js:80738:42
errorContext@http://localhost:4200/vendor.js:83975:5
subscribe@http://localhost:4200/vendor.js:80733:69
1891/switchMap/</<@http://localhost:4200/vendor.js:82897:100
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
1891/switchMap/</</innerSubscriber<@http://localhost:4200/vendor.js:82897:243
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
9736/map/</<@http://localhost:4200/vendor.js:82387:18
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
1527/take/</<@http://localhost:4200/vendor.js:82932:20
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
728/defaultIfEmpty/</<@http://localhost:4200/vendor.js:82177:20
5678/OperatorSubscriber/this._complete<@http://localhost:4200/vendor.js:82050:9
complete@http://localhost:4200/vendor.js:81135:12
384/fromArrayLike/<@http://localhost:4200/vendor.js:81825:16
_trySubscribe@http://localhost:4200/vendor.js:80744:19
2235/subscribe/<@http://localhost:4200/vendor.js:80738:113
errorContext@http://localhost:4200/vendor.js:83975:5
subscribe@http://localhost:4200/vendor.js:80733:69
728/defaultIfEmpty/<@http://localhost:4200/vendor.js:82172:12
4114/operate/</<@http://localhost:4200/vendor.js:84264:18
2235/subscribe/<@http://localhost:4200/vendor.js:80738:42
errorContext@http://localhost:4200/vendor.js:83975:5
subscribe@http://localhost:4200/vendor.js:80733:69
1527/take/<@http://localhost:4200/vendor.js:82930:12
4114/operate/</<@http://localhost:4200/vendor.js:84264:18
2235/subscribe/<@http://localhost:4200/vendor.js:80738:42
errorContext@http://localhost:4200/vendor.js:83975:5
subscribe@http://localhost:4200/vendor.js:80733:69
9736/map/<@http://localhost:4200/vendor.js:82386:12
4114/operate/</<@http://localhost:4200/vendor.js:84264:18
2235/subscribe/<@http://localhost:4200/vendor.js:80738:42
errorContext@http://localhost:4200/vendor.js:83975:5
subscribe@http://localhost:4200/vendor.js:80733:69
1891/switchMap/</<@http://localhost:4200/vendor.js:82897:100
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
1891/switchMap/</</innerSubscriber<@http://localhost:4200/vendor.js:82897:243
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
9736/map/</<@http://localhost:4200/vendor.js:82387:18
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
3738/tap/</<@http://localhost:4200/vendor.js:83039:18
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
1891/switchMap/</</innerSubscriber<@http://localhost:4200/vendor.js:82897:243
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
3738/tap/</<@http://localhost:4200/vendor.js:83039:18
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
8164/mergeInternals/doInnerSub/<@http://localhost:4200/vendor.js:82471:20
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
8164/mergeInternals/doInnerSub/<@http://localhost:4200/vendor.js:82471:20
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
384/fromArrayLike/<@http://localhost:4200/vendor.js:81823:18
_trySubscribe@http://localhost:4200/vendor.js:80744:19
2235/subscribe/<@http://localhost:4200/vendor.js:80738:113
errorContext@http://localhost:4200/vendor.js:83975:5
subscribe@http://localhost:4200/vendor.js:80733:69
doInnerSub@http://localhost:4200/vendor.js:82466:95
outerNext@http://localhost:4200/vendor.js:82461:52
5678/OperatorSubscriber/this._next<@http://localhost:4200/vendor.js:82034:15
next@http://localhost:4200/vendor.js:81119:12
7344/takeLast/</<@http://localhost:4200/vendor.js:82968:20
5678/OperatorSubscriber/this._complete<@http://localhost:4200/vendor.js:82050:9

Expected behavior

Storage service should work fine. It should not be possible for any component or module to access the firebase app before its created when its initialized in the app.module.ts imports array.

Actual behavior

Storage service causes Firebase error "ERROR Error: Uncaught (in promise): FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app)."

主要語言
TypeScript
星號
7.8k
分支
2.2k
平均合併
3 天 6 小時
30 天內合併 PR
5

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

angular/angularfire 的其他 Issue

查看 angular/angularfire 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。