我的firebase函数不起作用,我不明白,因为我的代码正确。
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin'
admin.initializeApp()
export const getfeed = functions.https.onRequest(async (req, res) => {
const docs = await admin.firestore().collection('posts').limit(10).get()
return docs.docs.map(doc => doc.data())
})
这是我的导航器的响应:
错误:无法加载默认凭据。浏览至https://cloud.google.com/docs/authentication/getting-started了解更多信息。在processTicksAndRejections(internal / process / task_queues.js)上的GoogleAuth.getApplicationDefaultAsync(C:\ Users \ tarik \ myApp \ firebase \ functions \ node_modules \ google-auth-library \ build \ src \ auth \ googleauth.js:161:19)中:93:5),位于异步GrpcClient上的异步GoogleAuth.getClient(C:\ Users \ tarik \ myApp \ firebase \ functions \ node_modules \ google-auth-library \ build \ src \ auth \ googleauth.js:503:17)。 _getCredentials(C:\ Users \ tarik \ myApp \ firebase \ functions \ node_modules \ google-gax \ build \ src \ grpc.js:108:24)在异步GrpcClient.createStub(C:\ Users \ tarik \ myApp \ firebase \函数\ node_modules \ google-gax \ build \ src \ grpc.js:229:23)
请帮助。