【发布时间】:2020-02-16 19:19:19
【问题描述】:
我正在使用here 描述的组织结构。我有以下functions/ 文件夹:
我的index.js文件如下:
const glob = require('glob')
const camelCase = require('camelcase')
const FUNCTIONS_FOLDER = './src'
const files = glob.sync('./src/**/*.func.js', {
cwd: __dirname,
ignore: './node_modules/**'
})
console.log('FILE LENGTH: ', files.length)
for (let f = 0, fl = files.length; f < fl; f++) {
const file = files[f]
console.log('FILE: ', file)
const functionName = camelCase(
file
.slice(5, -8)
.split('/')
.join('_')
) // Strip off '.func.js' and 'src/'
console.log('FUNCTION - PRE: ', functionName)
console.log('ENV ', process.env.FUNCTION_NAME)
if (
!process.env.FUNCTION_NAME ||
process.env.FUNCTION_NAME === functionName
) {
console.log('FUNCTION: ', functionName, file)
exports[functionName] = require(file)
}
}
我正在尝试部署functions/src/votes 目录中定义的两个云函数,但是,当我运行firebase deploy --only functions 时,只部署了我的onRequest.func.js 函数。我查看了 firebase functions:log 并得到以下信息:
即使我删除了支票
if (!process.env.FUNCTION_NAME || process.env.FUNCTION_NAME === functionName)
我的onWrite.func.js 仍未部署。
我做错了吗?我将非常感谢任何帮助!
编辑:这是我的整个函数/目录: https://github.com/markoelez/temp_functions
【问题讨论】:
-
如果有 github 链接到一个最小的可重现示例会很好
-
@x00 我链接了我的函数目录,希望对您有所帮助
标签: javascript reactjs firebase google-cloud-functions