我正试图在firestore云中编写简单的数据,但这些都是我遇到的错误。
这是我的代码,我正在尝试提交我创建的集合的数据
var admin = require("firebase-admin");
var serviceAccount = require("../key4.json");
// var admin = require("firebase-admin");
// var serviceAccount = require("path/to/serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
// databaseURL: "https://productapi-72b9f-default-rtdb.firebaseio.com"
});
const firestore = admin.firestore();
const path = require("path");
const fs = require("fs");
const directoryPath = path.join(__dirname, "files");
let data = {
"itemID": "MOMOS_NV_102",
"itemName": "Kadi Veg Momos",
"itemPriceHalf": 80,
"itemPriceFull": 130,
"hasImage": false,
"itemCategory": "momos_nv",
"itemType": "nv"
}
const items = firestore.collection('items').doc('BJ');
const res = items.set(data).then(() => {
console.log("Document successfully written!");
})
.catch((error) => {
console.error("Error writing document: ", error);
});
{
code: '400',
details: 'Getting metadata from plugin failed with error: invalid_grant: Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim.',
metadata: Metadata { internalRepr: Map {}, options: {} },
note: 'Exception occurred in retry method that was not classified as transient'
}
这和东京有关吗?我该怎么解决?
我得到了同步windows 10日期/时间的解决方案