AngularFire功能:服务功能不可用
AppModule
:
import { getApp, initializeApp, provideFirebaseApp } from "@angular/fire/app";
import { getFunctions, provideFunctions } from "@angular/fire/functions";
@NgModule({
imports: [
...
provideFirebaseApp(() => initializeApp(environment.firebase)),
provideFunctions(() => getFunctions(getApp())),
],
bootstrap: [AppComponent]
})
AppModule的子模块中的一个组件:
import { Functions } from "@angular/fire/functions";
constructor(
private functions: Functions,
) {}
每当此组件初始化时,我的应用程序崩溃,并且在控制台中会收到以下错误:
core.mjs:6485 ERROR Error: Uncaught (in promise): Error: Service functions is not available
Error: Service functions is not available
at Provider.getImmediate (index.esm2017.js:147:23)
at getFunctions (index.esm2017.js:651:49)
at angular-fire.js:227:48
at angular-fire.js:160:59
at _ZoneDelegate.invoke (zone.js:372:26)
at Zone.run (zone.js:134:43)
at NgZone.runOutsideAngular (core.mjs:25447:28)
at runOutsideAngular (angular-fire.js:160:35)
at angular-fire.js:227:21
at app.module.ts:92:28
at resolvePromise (zone.js:1211:31)
at resolvePromise (zone.js:1165:17)
at zone.js:1278:17
at _ZoneDelegate.invokeTask (zone.js:406:31)
at Object.onInvokeTask (core.mjs:25535:33)
at _ZoneDelegate.invokeTask (zone.js:405:60)
at Zone.runTask (zone.js:178:47)
at drainMicroTaskQueue (zone.js:585:35)
at invokeTask (zone.js:491:21)
at ZoneTask.invoke (zone.js:476:48)
我缺少什么?其他AngularFire模块工作正常,例如firestore
。
我的依赖性:
"firebase": "9.8.0",
"@angular/fire": "7.3.0",
"@angular/core": "~13.3.1"
更新:我已经尝试解决此问题了一段时间。突然的功能开始工作,但随后@angular/fire/fir/sesgaging
停止了。在某一时刻,我也有@angular/fir/firestore
无法正常工作。似乎总是有一个提供商不起作用,而其他所有提供商都可以,但是似乎是随机的。我的想法用完了。
AppModule
:
import { getApp, initializeApp, provideFirebaseApp } from "@angular/fire/app";
import { getFunctions, provideFunctions } from "@angular/fire/functions";
@NgModule({
imports: [
...
provideFirebaseApp(() => initializeApp(environment.firebase)),
provideFunctions(() => getFunctions(getApp())),
],
bootstrap: [AppComponent]
})
A component within a child module of AppModule:
import { Functions } from "@angular/fire/functions";
constructor(
private functions: Functions,
) {}
Whenever this component initialized, my app crashes and I get the following error in the console:
core.mjs:6485 ERROR Error: Uncaught (in promise): Error: Service functions is not available
Error: Service functions is not available
at Provider.getImmediate (index.esm2017.js:147:23)
at getFunctions (index.esm2017.js:651:49)
at angular-fire.js:227:48
at angular-fire.js:160:59
at _ZoneDelegate.invoke (zone.js:372:26)
at Zone.run (zone.js:134:43)
at NgZone.runOutsideAngular (core.mjs:25447:28)
at runOutsideAngular (angular-fire.js:160:35)
at angular-fire.js:227:21
at app.module.ts:92:28
at resolvePromise (zone.js:1211:31)
at resolvePromise (zone.js:1165:17)
at zone.js:1278:17
at _ZoneDelegate.invokeTask (zone.js:406:31)
at Object.onInvokeTask (core.mjs:25535:33)
at _ZoneDelegate.invokeTask (zone.js:405:60)
at Zone.runTask (zone.js:178:47)
at drainMicroTaskQueue (zone.js:585:35)
at invokeTask (zone.js:491:21)
at ZoneTask.invoke (zone.js:476:48)
What am I missing? Other AngularFire modules are working just fine, e.g. Firestore
.
My dependencies:
"firebase": "9.8.0",
"@angular/fire": "7.3.0",
"@angular/core": "~13.3.1"
Update: I've been trying to fix this for quite a while. Suddenly functions started working, but then @angular/fire/messaging
stopped. At one point I also had @angular/fire/firestore
not working. It seems like there's always one of the providers that doesn't work, while all the others do, but it seems random which one it is. I'm running out of ideas..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论