0
votes

I'am trying to connect to Firestore for my AngularApp (Angular 10) and it's not connecting its logging the below error in the console and no data is apperaing when I'm subscribing to the snapshot of the firestore collection.

Console Logs:

index.esm.js:106 [2020-09-05T09:53:01.695Z] @firebase/firestore: Firestore (7.19.1): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds. This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

Failed to load resource: net::ERR_CONNECTION_TIMED_OUT

My Service

import { Injectable } from '@angular/core';
import {EdcellEvent} from 'src/app/models/edcell_event/edcell-event.model';
import { AngularFirestore } from '@angular/fire/firestore';
@Injectable({
  providedIn: 'root'
})
export class FirestoreEdcellEventsService {

  constructor(private firestore: AngularFirestore) { }
  
  getEvents() {
    console.log(this.firestore.collection('events'));
    return this.firestore.collection('events').snapshotChanges();
}
createEvent(edcell_event:EdcellEvent){
  return this.firestore.collection('events').add(edcell_event);
}
}

My Component

import { Component, OnInit, NgZone } from '@angular/core';
import { FirestoreEdcellEventsService } from 'src/app/services/firestore-edcell-events.service';
import { EdcellEvent } from 'src/app/models/edcell_event/edcell-event.model';
import { from } from 'rxjs';

@Component({
  selector: 'app-home-page',
  templateUrl: './home-page.component.html',
  styleUrls: ['./home-page.component.css']
})
export class HomePageComponent implements OnInit {
  edcell_events: EdcellEvent[];

  constructor(private ngZone: NgZone, private edcell_event_sevice: FirestoreEdcellEventsService) { }



  myevent: EdcellEvent = {
    id: "",
    title: "Title",
    descrition: "Des",
    link: "htttppp",
    img: "htpsjpg",
  };

  submit() {
    this.edcell_event_sevice.createEvent(this.myevent);
    console.log('clicked submit');
  }

  ngOnInit(): void {
    console.log(this.edcell_event_sevice.getEvents());
    this.edcell_event_sevice.getEvents().subscribe(data => {
      this.edcell_events = data.map(e => {
        console.log("Data >>", e);
        return {
          id: e.payload.doc.id,
          ...e.payload.doc.data() as {},

        } as EdcellEvent;
    })
  });
}

}

1
In You error You have info about this problem "This typically indicates that your device does not have a healthy Internet connection at the moment". just improve the connection or wait until it got wet by itselfTomasz Vizaint
Hey I didnt have any network issue , my connection is stable at 50mbps, thats definetly not the problem and I dont have any antivirus or blocking shit tooRamana G
But You error say about not healthy internet connection, this issue,occur when in background is downloading some upgrade or another task, or simple You computer lost connection, for some reason.Tomasz Vizaint
@TomaszVizaint I've the same issue, and I'm connected through RJ45 to my router which is connected to the optic fiber, definitely not a connection issue in my case. I mean, just to give an idea, I've 2ms pings to differents servers, just ran a speed test and got a 85/93Mbps speed. I'm not over some mobile/wifi connection and I'm not downloading a big bunch of stuff(+ I'm only syncing one document from firebase)J4N

1 Answers

0
votes

This issue could be both client-side or server-side. It's important to isolate your connection first. However, there have been such bugs before like this one.

If the problem persists after troubleshooting your local connectivity, please submit a request here or on the Github repo. Linking your request/solution as comment on this page will also help others if they have the same issue.