title: error while retrieving information from firestore through cloud functions
body: <p>this is the screenshot of how my firestore database looks.</p>
  
  <p><a href="https://i.stack.imgur.com/9cOzA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9cOzA.png" alt="enter image description here"></a></p>
  
  <p>i am trying to retrieve this information from index.js file in cloud functions
  my index.js file looks like :</p>
  
  <pre><code>const functions = require('firebase-functions');
  const express = require('express');
  const firebase = require('firebase-admin');
  
  const firebaseApp = firebase.initializeApp(
      functions.config().firebase
  );
  const db = firebaseApp.firestore();
  const app = express();
  
  app.set('view engine','ejs');
  //-------------------------------------------------------------------//
  
  app.get("/home",function(req,res){
      db.collection('users').get().then((snapshot)=&gt;{
          console.log(snapshot.docs);
      });
  });
  
  exports.app = functions.https.onRequest(app);
  </code></pre>
  
  <p>whenn i run the command : firebase serve --only functions,hosting<br>
  i am getting this error :</p>
  
  <pre><code>⚠  Your requested "node" version "8" doesn't match your global version "12"
  ✔  functions: functions emulator started at http://localhost:5001
  i  functions: Watching "/home/chahat/Desktop/firebase 2.0/functions" for Cloud Functions...
  i  hosting: Serving hosting files from: public
  ✔  hosting: Local server: http://localhost:5000
  ⚠  functions: The Cloud Firestore emulator is not running, so calls to Firestore will affect production.
  ✔  functions[app]: http function initialized (http://localhost:5001/samsungmap-17515/us-central1/app).
  ⚠  functions: The Cloud Firestore emulator is not running, so calls to Firestore will affect production.
  i  functions: Beginning execution of "app"
  i  functions: Finished "app" in ~1s
  i  functions: Beginning execution of "app"
  ⚠  External network resource requested!
     - URL: "http://169.254.169.254/computeMetadata/v1/instance"
   - Be careful, this may be a production service.
  ⚠  External network resource requested!
     - URL: "http://metadata.google.internal./computeMetadata/v1/instance"
   - Be careful, this may be a production service.
  &gt;  (node:6741) UnhandledPromiseRejectionWarning: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
  &gt;      at GoogleAuth.getApplicationDefaultAsync (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:160:19)
  &gt;      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  &gt;      at async GoogleAuth.getClient (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:502:17)
  &gt;      at async GrpcClient._getCredentials (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-gax/build/src/grpc.js:92:24)
  &gt;      at async GrpcClient.createStub (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-gax/build/src/grpc.js:213:23)
  &gt;  (node:6741) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
  &gt;  (node:6741) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  ⚠  functions: Your function timed out after ~60s. To configure this timeout, see
        https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation.
  &gt;  /usr/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:619
  &gt;                  throw new Error("Function timed out.");
  &gt;                  ^
  &gt;  
  &gt;  Error: Function timed out.
  &gt;      at Timeout._onTimeout (/usr/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:619:23)
  &gt;      at listOnTimeout (internal/timers.js:549:17)
  &gt;      at processTimers (internal/timers.js:492:7)
  </code></pre>
  
  <p>//------------UPDATE---------------------------//</p>
  
  <p>After using :</p>
  
  <pre><code>app.get("/home",function(req,res){
      db.collection('users').get().then((snapshot)=&gt;{
          res.json(snapshot.docs)
      });
  });
  </code></pre>
  
  <p>rather than my prev home route, i am still getting the following error which i am unable to understand . 
  ERROR : </p>
  
  <pre><code>    chahat@chahat:~/Desktop/firebase 2.0$ firebase serve --only functions,hosting
  ⚠  Your requested "node" version "8" doesn't match your global version "12"
  ✔  functions: functions emulator started at http://localhost:5001
  i  functions: Watching "/home/chahat/Desktop/firebase 2.0/functions" for Cloud Functions...
  i  hosting: Serving hosting files from: public
  ✔  hosting: Local server: http://localhost:5000
  ⚠  functions: The Cloud Firestore emulator is not running, so calls to Firestore will affect production.
  ✔  functions[app]: http function initialized (http://localhost:5001/samsungmap-17515/us-central1/app).
  ⚠  functions: The Cloud Firestore emulator is not running, so calls to Firestore will affect production.
  i  functions: Beginning execution of "app"
  i  functions: Finished "app" in ~1s
  i  functions: Beginning execution of "app"
  ⚠  External network resource requested!
     - URL: "http://169.254.169.254/computeMetadata/v1/instance"
   - Be careful, this may be a production service.
  ⚠  External network resource requested!
     - URL: "http://metadata.google.internal./computeMetadata/v1/instance"
   - Be careful, this may be a production service.
  ⚠  functions: The Cloud Firestore emulator is not running, so calls to Firestore will affect production.
  i  functions: Beginning execution of "app"
  ⚠  External network resource requested!
     - URL: "http://169.254.169.254/computeMetadata/v1/instance"
   - Be careful, this may be a production service.
  ⚠  External network resource requested!
     - URL: "http://metadata.google.internal./computeMetadata/v1/instance"
   - Be careful, this may be a production service.
  &gt;  (node:16552) UnhandledPromiseRejectionWarning: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
  &gt;      at GoogleAuth.getApplicationDefaultAsync (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:160:19)
  &gt;      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  &gt;      at async GoogleAuth.getClient (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:502:17)
  &gt;      at async GrpcClient._getCredentials (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-gax/build/src/grpc.js:92:24)
  &gt;      at async GrpcClient.createStub (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-gax/build/src/grpc.js:213:23)
  &gt;  (node:16552) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
  &gt;  (node:16552) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  &gt;  (node:16583) UnhandledPromiseRejectionWarning: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
  &gt;      at GoogleAuth.getApplicationDefaultAsync (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:160:19)
  &gt;      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  &gt;      at async GoogleAuth.getClient (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:502:17)
  &gt;      at async GrpcClient._getCredentials (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-gax/build/src/grpc.js:92:24)
  &gt;      at async GrpcClient.createStub (/home/chahat/Desktop/firebase 2.0/functions/node_modules/google-gax/build/src/grpc.js:213:23)
  &gt;  (node:16583) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
  &gt;  (node:16583) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  ⚠  functions: Your function timed out after ~60s. To configure this timeout, see
        https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation.
  &gt;  /usr/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:619
  &gt;                  throw new Error("Function timed out.");
  &gt;                  ^
  &gt;  
  &gt;  Error: Function timed out.
  &gt;      at Timeout._onTimeout (/usr/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:619:23)
  &gt;      at listOnTimeout (internal/timers.js:549:17)
  &gt;      at processTimers (internal/timers.js:492:7)
  </code></pre>
  
  <p>please help.
  thankyou </p>