ktr*_*ace 0 google-cloud-functions
Google Cloud Functions 模拟器仅在 Node 6 上受支持:https : //github.com/GoogleCloudPlatform/cloud-functions-emulator
注意:模拟器仅支持 Node v6.xx,不支持 Node v8.xx 或 Python。”
但是,Node 6 已弃用 Google Cloud Functions:https : //cloud.google.com/functions/docs/concepts/nodejs-6-runtime
Node.js 6 运行时已被弃用。为确保您的函数位于受支持的 Node.js 版本上,请将它们迁移到 Node.js 8 或 Node.js 10。2020 年 4 月 22 日之后,将阻止使用 Node.js 6 的函数部署。在此之后继续使用 Node.js 6 的 Cloud Functions 可能会被禁用。”
我如何在本地运行函数(为 Node 8 编写)?
谷歌(2019 年 4 月)刚刚为基于 Node.js 的逻辑的 Cloud Functions 发布了一个新的测试和开发框架。这个框架的名字叫做Node.js 的 Functions Framework,在 Github 上开源。如果您访问刚刚提供的链接,您将找到有关如何下载和使用它的详细文档。在最高(和总结)级别:
npm install @google-cloud/functions-framework
编写您的代码。
exports.helloWorld = (req, res) => {
res.send('Hello, World');
};
Run Code Online (Sandbox Code Playgroud)
npx @google-cloud/functions-framework --target=helloWorld虽然这些是备忘单,但我强烈建议您阅读 Github 存储库中的整个 README 文档。
| 归档时间: |
|
| 查看次数: |
1653 次 |
| 最近记录: |