运行DataGridView1.DataSource
时收到以下错误消息:
firebase deploy --only functions
这是我的代码,是从documentation复制的:
Error parsing triggers: Cannot find module './clone.js'
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
const bucketName = 'myapp.appspot.com';
const filename = './hola_mundo.wav';
admin.initializeApp();
exports.Storage = functions.firestore.document('Test_Value').onUpdate((change, context) => {
storage.bucket(bucketName).upload(filename, {
gzip: true,
metadata: {
cacheControl: 'no-cache'
}
})
.then(() => {
console.log(`${filename} uploaded to ${bucketname}`);
})
.catch(err => {
console.error(err);
});
});
是这个npm module吗?
答案 0 :(得分:1)
我将常量移到函数中,错误消失了:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.Storage = functions.firestore.document('Test_Value').onUpdate((change, context) => {
const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
const bucketName = 'myapp.appspot.com';
const filename = './hola_mundo.wav';
storage.bucket(bucketName).upload(filename, {
gzip: true,
metadata: {
cacheControl: 'no-cache'
}
})
.then(() => {
console.log(`${filename} uploaded to ${bucketname}`);
})
.catch(err => {
console.error(err);
});
});