javascript - 具有多个函数的处理程序中的“类型错误:lambda 不是函数”
问题描述
我的 handler.js 文件中有两个函数,并且在 serverless.yml 中正确配置了它们。问题是,当我运行调用时,只有第一个有效,第二个抛出类型错误:“lambda 不是函数”。
我确保我的 yml 文件或处理程序文件中没有拼写错误。另外,我尝试将函数放入单独的文件中。它们都不起作用。
在我的 handler.js 我有
const one = async (event, context, callback) => {
//code here
};
const two = async (event, context, callback) => {
//code here
};
module.exports = {
one,
two
};
在我的 yml 文件中,我有
functions:
one:
handler: handler.one
events:
- http: POST one
two:
handler: handler.two,
events:
- http: POST two
调用one
工作正常,但调用two
会引发错误。
解决方案
推荐阅读
- python - 将日期和时间列转换为天数列
- excel - 如何让 Excel 无法将数字识别为日期?
- reactjs - 在映射的卡片集中添加列数
- multithreading - 在 Rust 中协调队列和线程?
- java - Java中的多线程:如何在账户之间正确转移资金?
- sql - 用于查找打开的 sql 查询
- javascript - Angular Material 的样式(css)与文档中的样式(css)不同
- html - Spectrum.chat 如何隐藏辅助频道部分的滚动条
- html - 如何通过更改浏览器窗口的宽度来更改元素的宽度和高度?
- shopify - 扩展高级 Shopify 主题的最佳实践