Title: Firebase APIs outside of an Injection context · Issue #3607 · angular/angularfire · GitHub
Open Graph Title: Firebase APIs outside of an Injection context · Issue #3607 · angular/angularfire
X Title: Firebase APIs outside of an Injection context · Issue #3607 · angular/angularfire
Description: I keep getting error about, Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. I did properly set up the angular firebase integration although sig...
Open Graph Description: I keep getting error about, Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. I did properly set up the a...
X Description: I keep getting error about, Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. I did properly set up the a...
Opengraph URL: https://github.com/angular/angularfire/issues/3607
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Firebase APIs outside of an Injection context","articleBody":"I keep getting error about,\n\nCalling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs.\n\nI did properly set up the angular firebase integration although signIn, logIn working properly, but this error won't resolve and it makes the authentication delay at each reload.\n\n\nAppconfig.ts -\n\nconst firebaseConfig = {\n apiKey: \"************\",\n authDomain: \"************\",\n projectId: \"************\",\n storageBucket: \"************\",\n messagingSenderId: \"************\",\n appId: \"************\"\n }\n\nexport const appConfig: ApplicationConfig = {\n providers: \n [\n provideZoneChangeDetection({ eventCoalescing: true }),\n provideRouter(routes),\n provideHttpClient(),\n provideFirebaseApp(() => initializeApp(firebaseConfig)),\n provideAuth(() => getAuth()),\n provideFirestore(() => getFirestore())\n ]\n};\n\nService:\n\n auth: Auth = inject(Auth)\n fireStore: Firestore = inject(Firestore)\n ngZone = inject(NgZone)\n\n userSubject: BehaviorSubject\u003cany> = new BehaviorSubject\u003cany>(null)\n\n private authSubscription;\n\n constructor() {\n this.authSubscription = this.auth.onAuthStateChanged(user => {\n this.userSubject.next(user)\n })\n }\n\n signUp(fullName: string, email: string, password: string, username: string, phone: string = '', address: string = '', pincode: string): Observable\u003cvoid> {\n return this.ngZone.run(() => {\n\n const promise = createUserWithEmailAndPassword(this.auth, email, password)\n .then(response => {\n const userCredentials = response.user;\n if (userCredentials) {\n return sendEmailVerification(userCredentials)\n .then(() => {\n // Update profile with username\n return updateProfile(userCredentials, { displayName: username })\n .then(() => {\n // Save user details in Firestore\n return this.saveUserDetails(response.user.uid, fullName, address, phone, pincode);\n })\n .catch(error => {\n console.error(\"Error updating profile:\", error);\n throw new Error('Profile update failed');\n });\n })\n .catch(error => {\n console.error(\"Error sending email verification:\", error);\n throw new Error('Email verification failed');\n });\n } else {\n throw new Error('User credentials not found');\n }\n })\n .catch(error => {\n console.error(\"Error during signup:\", error);\n throw error; // Propagate the error\n });\n\n return from(promise).pipe(\n map(() => { }),\n catchError(error => {\n console.error(\"Error in signup:\", error);\n return throwError(() => new Error(error.message)); // Return an error observable\n })\n );\n })\n\n }\n\n\n saveUserDetails(uid: string, fullName: string, address: string, phone: string, pincode: string): Promise\u003cvoid> {\n const userRef = doc(this.fireStore, 'users', uid)\n\n return setDoc(userRef, {\n fullName: fullName,\n address: address,\n phone: phone,\n pincode: pincode\n }).then(() => {\n console.log(\"User details saved in Firestore.\");\n }).catch((error) => {\n console.error(\"Error saving user details in Firestore:\", error);\n throw error; // rethrow to propagate error in the stream\n });\n }\n\n\nComponent:\n\n onSubmit() {\n const rawForm = this.signUpForm.getRawValue();\n\n this.loader.showLoader()\n this.authService.signUp(rawForm.name,rawForm.email, rawForm.password, rawForm.username, rawForm.phone, rawForm.address, rawForm.pincode).subscribe((next) => {\n this.router.navigateByUrl('/email-ver')\n this.loader.hideLoader()\n }, err => {\n console.log('Some error occurred during signup', err);\n this.loader.hideLoader()\n })\n }","author":{"url":"https://github.com/itskaif07","@type":"Person","name":"itskaif07"},"datePublished":"2025-01-07T17:44:01Z","url":"https://github.com/angular/angularfire/issues/3607"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fb625cd6-0b4f-4055-0211-80c4ddb5be79 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C254:BF60A:2FA441F:3F557C0:6B0359F4 |
| html-safe-nonce | d5caa7e75d4e9d3789eb2e19eddae2bbb5db635f3d9efad6c17d07b57ad5480c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjU0OkJGNjBBOjJGQTQ0MUY6M0Y1NTdDMDo2QjAzNTlGNCIsInZpc2l0b3JfaWQiOiIzMjEyNjQ5MjcwMjEzODI3MDYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1e1917dd1ef94aad225922c4f5bb662a491e504408f952a231fabdc20a6adc06 |
| hovercard-subject-tag | issue:2773408832 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angularfire/3607/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9e0e97a8c7e68a27085f9c7fb13fc35c69ca2e651ae971042df63d79bbda18b9/angular/angularfire/issues/3607 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9e0e97a8c7e68a27085f9c7fb13fc35c69ca2e651ae971042df63d79bbda18b9/angular/angularfire/issues/3607 |
| og:image:alt | I keep getting error about, Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. I did properly set up the a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | itskaif07 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angularfire git https://github.com/angular/angularfire.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 49453413 |
| octolytics-dimension-repository_nwo | angular/angularfire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49453413 |
| octolytics-dimension-repository_network_root_nwo | angular/angularfire |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width