【发布时间】:2018-05-31 18:59:07
【问题描述】:
我创建了一个 expressjs 应用程序,并尝试将其部署到 Google Cloud Functions 中。
我自己开发了该应用程序,然后按照guide 将其附加到 gCloud 功能服务。
基本上,我在项目的根目录中创建了一个index.js 文件
var app = require('./app');
function App(req,res) {
if (!req.url) {
req.url = '/';
req.path = '/';
}
return app(req,res);
}
var converter = App;
module.exports = {
converter
};
ps。为了测试,我留下了名称转换器以符合指南,我会在它工作后立即更新它;D
我的项目现在是这样的
- myAppProject
--- index.js
--- app.js
--- package.json
--- someFolderWithCode
------ someFile.js
我压缩了代码并使用 gCloud 控制台(又名 webapp)上传 zip 并定义了函数 converter,这与我的 index.js 中导出的函数相同。
问题是我得到了这个错误
Function load error: File index.js or function.js that is expected to define function doesn't exist in the root directory.
我无法理解我错过了什么。
【问题讨论】:
标签: node.js express google-cloud-platform google-cloud-functions