从Firebase读取数据时Http2CallStream.call.on错误

时间:2019-09-14 21:12:44

标签: node.js firebase google-cloud-firestore firebase-admin

我创建了一个名为“ config”的集合 使用“ firebase->数据库-> Cloud Firestore”服务。

我想读取其中的所有数据 这是我得到的错误:

Error:
    at Http2CallStream.call.on (C:\Users\alihe\Desktop\test\node_modules\@grpc\grpc-js\build\src\call.js:68:41)
    at Http2CallStream.emit (events.js:187:15)
    at process.nextTick (C:\Users\alihe\Desktop\test\node_modules\@grpc\grpc-js\build\src\call-stream.js:71:22)
    at process._tickCallback (internal/process/next_tick.js:61:11)
  code: 13,
  details: '',
  metadata: Metadata { options: undefined, internalRepr: Map {} } }
Code:

const admin = require('firebase-admin');
const serviceAccount = require('./serviceAccountKey.json');

admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: serviceAccount.databaseURL
});

const db = admin.firestore();

db.collection('config').get()
.then(snapshot => {
    console.debug(snapshot);
})
.catch(err => {
    console.error(err);
});

0 个答案:

没有答案