Issue
I’m using Firestore with Nodejs (expressjs framework) and the first simple request takes more than 25 seconds!
and if i get the same request with JavaScript in the client-side or with Rest API tool like (postman) i get the data immediately! no problem!
So what is the issue here?
this is the code:
var express = require('express');
var router = express.Router();
const admin = require("firebase-admin");
const serviceAccount = require("../privte/quiztestweb-firebase-adminsdk-vd7zn-1a3a896f60.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://quiztestweb.firebaseio.com"
});
/* GET users listing. */
router.get('/', function (req, res, next) {
let db = admin.firestore();
db.collection("/quizzes/quiz_1/tests/").get()
.then((snapshot) => {
snapshot.forEach((doc) => {
console.log(doc.id, '=>', doc.data());
});
})
.catch((err) => {
console.log('Error getting documents', err);
});
res.send('respond with a resource');
});
module.exports = router;
Solution
Finally!
i solve this issue by removing the new version of firebase package and replace it with an older one!
((but it’s still just a temporary solution .. until fixed by firebase
developers))
Answered By – zakaria chahboun
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0